Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

C/XS Generator

by plobsing (Friar)
on Jan 23, 2008 at 05:06 UTC ( [id://663743]=perlquestion: print w/replies, xml ) Need Help??

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

Hi all,

I have given myself the task of automatically generating some XS files. I caught myself starting to roll my own XS writer and asked myself: Are there any modules which would facilitate this?

I have seen Language::XS on CPAN which is half implemented and lacks some functionality I want (such as BOOT sections). Also I don't need the compiling and linking which it provides. All I am looking for is a handy way to write XS source code.

Is there anything that might help me?

Replies are listed 'Best First'.
Re: C/XS Generator
by randyk (Parson) on Jan 23, 2008 at 06:14 UTC
      Wow!

      I had actually overlooked that one because it looks like something that just parses C and builds XS like h2xs. I had no idea that it was so extensible.

      Thanks
Re: C/XS Generator
by sgt (Deacon) on Jan 23, 2008 at 20:43 UTC

    Besides randyk 's answer, I wonder if some part of Inline and its translators InlineX::* (to XS) could be useful.

    cheers --stephan
      That was the first place I looked.

      Actually, I am attempting to make an ILSM for Fortran. I've got a parser thats *good enough* (for now). The trick is in the glueing bit.

      Unlike most other Inline modules, which are interpreted, there's no runtime to which you can delegate method calling and reflection. I suspect thats why there are only 3 compiled ILSMs, one of which is a joke, and all of which are supported by people much wiser than I.

      You can't just delegate type conversion for interesting values, such as multi-dimensional arrays of structs, to the user like Inline::C does because that means they need access to the perlapi, but then I would need to rewrite many of the structs and create a ton of call-by-reference bridges. Also its a real pain to manipulate pointers in standard Fortran.

      That leaves my code writing the glue. I can write the glue for any particular case, but a generic automatic solution is a little tougher especially if you want to support the features of Fortran that C does not have (which is half the point).

        Anything useful from the PDL camp?

        cheers --stephan

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-19 14:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found