Andrew, I think you may be able to get by with something like this. The info() method is not directly callable, but by creating an Inline::C destructor you can access it and get the details about the methods bound to Perl.
=== calc.c, compiled into libcalc.so === int add(int a, int b){ return a + b ; } int mult(int a, int b){ return a * b ; } === calc.h === int add(int a, int b) ; int mult(int a, int b) ; === t.pl === use strict ; use Inline ; use File::Spec ; my $lib = "./libcalc.so" ; my $header = "./calc.h" ; my $info = undef ; my ($v, $libdir, $libfile) = File::Spec->splitpath(File::Spec->rel2abs($lib)) ; $libfile =~ s/^lib// ; $libfile =~ s/\.so$// ; sub Inline::C::DESTROY { my $o = shift ; my @info = split(/\n/, $o->info()) ; shift @info ; $info = join("\n", @info) ; $o->SUPER::DESTROY ; } Inline->bind( C => $header, LIBS => "-L$libdir -l$libfile ", ENABLE => 'AUTOWRAP', ENABLE => 'FORCE_BUILD', # ENABLE => 'BUILD_NOISY', ) ; print "$info\n" ; print add(1, mult(3, 2)) . "\n" ; Patrick On Thu, Apr 28, 2011 at 6:09 PM, DeFaria, Andrew <andrew.defa...@tellabs.com> wrote: > Hi. I've been using Inline::C CPAN module for an assignment and I have a few > questions. In general I'm quite impressed and think this is an excellent > module for the task that I have been assigned, which is to write a shell in > Perl to talk to arbitrary C libraries allowing the user the ability to call > and exercise their C library. As such it would be great if I could simply > give Inline C a .h file and a .a file and it would figure out all of the > functions defined in the .h file. I've been attempting to use Automatic > Function > Wrappers<http://search.cpan.org/%7Esisyphus/Inline-0.48/C/C-Cookbook.pod#Automatic_Function_Wrappers> > but it seems I have to parse the .h file myself and determine the functions > contained therein then compose a string of their prototypes. > > Also, is there any way to call Config? I'd like to do this for two different > reasons. First off I'd like to offer the ability to the user to tell my Perl > shell that they want to load say "mynewlib.h" that has a corresponding > "mynewlib.a" at run time. Now I can call bind at run time to bind this > mynewlib.h but I cannot call config to configure the LIBS parm to have > "-L/path/to/mynewlib -lmynewlib" since I've only seen how to do this with the > "use" statement which is done at compile time. > > Secondly I'd like to be able to call INFO and get the list of C functions > that have been successfully bound to Perl for documentation purposes. I'd > like to be able to put out a help screen and show the user what C functions > he can call. > > So then it would be great if I could tell Inline C "Here's a .h file and > here's the LIB information as to where the compiled code is. Please bind all > C functions you find a prototype for. Oh and allow me to inquire about them > through info". > > Thanks in advance. > > > -- > Andrew DeFaria<http://defaria.com> > FATAL ERROR! SYSTEM HALTED! - Press any key to do nothing. > > ============================================================ > The information contained in this message may be privileged > and confidential and protected from disclosure. If the reader > of this message is not the intended recipient, or an employee > or agent responsible for delivering this message to the > intended recipient, you are hereby notified that any reproduction, > dissemination or distribution of this communication is strictly > prohibited. If you have received this communication in error, > please notify us immediately by replying to the message and > deleting it from your computer. Thank you. Tellabs > ============================================================ > -- ===================== Patrick LeBoutillier Rosemère, Québec, Canada