Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Accessing compiled libraries

by templer (Initiate)
on Jan 20, 2005 at 22:19 UTC ( [id://423811]=perlquestion: print w/replies, xml ) Need Help??

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

I have a PCM-GPIB card with a visual c++ import library and header "*.h" file. How do I import these functions for use in perl? I've chosen the path of perl 5.8.4.810.

templer

Replies are listed 'Best First'.
Re: Accessing compiled libraries
by Joost (Canon) on Jan 20, 2005 at 23:10 UTC
    First, you need a working C / C++ compiler (preferably the same compiler that was used to build your perl binary).

    Then, if your header files are really simple, you might try h2xs to automatically convert header routines to XS code. h2xs is part of your standard perl install. XS code is a sort of C dialect with extra macros and syntactic sugar in which you can specify the calling conventions for subroutines than can then be called from perl.

    Usually, though, you will need to write the XS code by hand. Take a look at the following manpages: perlapi perlxs, perlintern, perlguts, perlcall and perlembed.

    Also useful are the "Advanced Perl Programming" and "Extending and Embedding Perl" books, and PerlGuts Illustrated.

    Oh, and before I forget - you might want to take a look at Inline::C and its relatives. They can make it a lot easier to start experimenting with C / XS / Perl programming

      thank you, templer
Re: Accessing compiled libraries
by dfaure (Chaplain) on Jan 20, 2005 at 23:15 UTC
      thank you,

      templer

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://423811]
Approved by Joost
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-18 17:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found