gri6507 has asked for the wisdom of the Perl Monks concerning the following question:
where, for the sake of this question, foo.c isuse warnings; use strict; use File::Spec; use File::Basename; my $inlineCFile; my $inlineCFile2; my $relSourcePath; my $inlineBuildDir; my $libDir; my $incDir; BEGIN { $relSourcePath = File::Spec->rel2abs(dirname($0)); $inlineCFile = File::Spec->catfile($relSourcePath, "foo.c"); $inlineCFile2 = File::Spec->catfile($relSourcePath, "bar.c"); my @dirs = (); push @dirs, $relSourcePath; push @dirs, ".Inline"; $inlineBuildDir = File::Spec->catdir(@dirs); pop @dirs; push @dirs, "lib"; $libDir = File::Spec->catdir(@dirs); pop @dirs; push @dirs, "include"; $incDir = File::Spec->catdir(@dirs); } use Inline ( C => Config => LIBS => "-L$libDir", INC => "-I$incDir", DIRECTORY => $inlineBuildDir, ); use Inline C => $inlineCFile; use Inline C => $inlineCFile2; HelloFoo(); HelloBar();
and bar.c isvoid HelloFoo() { printf("hello from foo\n"); }
Now, let's say that I want to pull in many more such Inline::C files into my script. Is there a better way than the individual scalar definition for each C file inside the BEGIN block followed by the individual use Inline::C => $myFile?void HelloBar() { printf("hello from bar\n"); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Using multiple Inline::C files
by tilly (Archbishop) on Feb 13, 2014 at 15:51 UTC | |
by gri6507 (Deacon) on Feb 13, 2014 at 15:58 UTC |