Fellow Monks, I have a script which uses Inline::C to pull in several files. Currently it looks like this.
use 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();
where, for the sake of this question, foo.c is
void HelloFoo() { printf("hello from foo\n"); }
and bar.c is
void HelloBar() { printf("hello from bar\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?

In reply to Using multiple Inline::C files by gri6507

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.