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

Hi, I'm trying to generate Perl bindings for Alsaplayer library. I go with :

h2xs -x control /usr/local/include/alsaplayer/control.h -lalsaplayer

Then do : perl Makefile.PL, make make install and test package.

What I don't like is I get more C-like subroutines that are odd to call from Perl.

When I do "make" I get warning like " Please specify prototyping behaviour for control.xs" - is this preventing generation of more Perl-friendly subroutines ?

Is there any other setting for improving this - or is "manual" programming onley solution ?


Thanks,
Robert.

Replies are listed 'Best First'.
Re: h2x: "Plese specifiy protoyping behaviour for..."
by Joost (Canon) on Jan 19, 2004 at 11:09 UTC
    AFAIK this warning is about Perl prototypes for XS routines, which usually do NOT make a more Perl-friendly API :-)

    To disable these warnings put

    PROTOTYPES: DISABLE
    On the line after your MODULE declaration in the xs file(s).

    Anyway, you probably have some manual work to do to make the interface more perl-friendly, possibly by taking the h2xs generated code as a starting point. You could also try to make Perl wrappers around the XS code if you feel more comfortable with Perl than with C.

    For a friendly introduction to XS and extending Perl in general, I can also recommend the Manning book "Extending and Embedding Perl".

    HTH,
    Joost.

Re: h2x: "Plese specifiy protoyping behaviour for..."
by gellyfish (Monsignor) on Jan 19, 2004 at 11:35 UTC

    As well as specifying the prototyping behaviour in the .xs file you can specify:

    XSPROTOARG => '-noprototypes'
    in the arguments to WriteMakefile() in your Makefile.PL

    /J\