Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

C structures ?

by carcassonne (Pilgrim)
on Dec 13, 2005 at 17:35 UTC ( #516365=perlquestion: print w/replies, xml ) Need Help??

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

Folks,

Is there a way (or many !) to use the definition of structures in C header files in a Perl program ? The idea is to use already-defined structures from a previous project while saving - if possible - time re-writing them from scratch in Perl.

Thanks.

Replies are listed 'Best First'.
Re: C structures ?
by derby (Abbot) on Dec 13, 2005 at 18:49 UTC

    Why stop at the structures? If you have a decent library to go with the structures, use it also. <blatant_xp_grasp>Check out my Inline::C tutorial that uses the c services lib</blatant_xp_grasp>.

    -derby
Re: C structures ?
by CountOrlok (Friar) on Dec 13, 2005 at 17:51 UTC
    Maybe h2ph is the answer to your prayers. (man h2ph)
    -imran
Re: C structures ?
by samtregar (Abbot) on Dec 13, 2005 at 19:24 UTC
    While Inline::C may help you'll probably have to write some interface code if you have large and/or complex structures. SWIG may be a better tool for this job since it has lots of automated interface generation built-in and can handle just about any legal C structure. I used it when I was working on Coagula and it was a real champ.

    -sam

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2020-10-24 01:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (242 votes). Check out past polls.

    Notices?