Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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:


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.


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>.

Re: C structures ?
by CountOrlok (Friar) on Dec 13, 2005 at 17:51 UTC
    Maybe h2ph is the answer to your prayers. (man h2ph)
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.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2021-09-18 14:23 GMT
Find Nodes?
    Voting Booth?

    No recent polls found