Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 romping around the Monastery: (9)
As of 2018-10-16 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (86 votes). Check out past polls.

    Notices?