Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, can somebody tell me how do invoke a C function which takes a C structire as argument, from a perl script..? can I define a typemap for C structure..? jayesh@india.hp.com

Replies are listed 'Best First'.
Re: calling C function from Perl
by davorg (Chancellor) on Dec 06, 2000 at 16:11 UTC

    This is done using a Perl feature called XS. You should look at perldoc perlxstut and perldoc perlxs

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me

Re: calling C function from Perl
by mirod (Canon) on Dec 06, 2000 at 16:45 UTC
      There is also an article on Inline.pm in the latest issue of The Perl Journal. Aside from XS and Inline, you may also want to look at SWIG.

      Cheers,
      KM

Re: calling C function from Perl
by strredwolf (Chaplain) on Dec 06, 2000 at 19:02 UTC
    Use Inline, which will let you embed your C code into the Perl code eazily. It also makes making modules easier, so you'll be able to make, say, RedWolf::Graphics.

    --
    $Stalag99{"URL"}="http://stalag99.keenspace.com";