in reply to Re: perlxs INTERFACE problem
in thread perlxs INTERFACE problem

Yeah it's the same compiler. Something else must be wrong... maybe I'm missing an option. I'm going to keep trying.

As for add_one/add_two I ment that one was the first and one was the second, not what they return >.< Silly me, I think they get the award for worst function names of the day.

Replies are listed 'Best First'.
Re^3: perlxs INTERFACE problem
by Fiftyvolts (Novice) on Nov 15, 2007 at 13:50 UTC

    Ok I think I have the solution. It appears to be a combination of my compiler and my XSUB.h file (which I guess is really a statement of my perl version 5.6.1)

    So 5.6.1 defines the macro that extracts the C function to call for a particular invocation of the perl interface something to the effect of this: (I expanded some of the macros for clarity)

    XSFUNCTION = ((ret (*cv)())(XSANY.dptr));

    Of course the cast shown above grossly violates the C standard for abstract declarators (no identifiers should be present, a.k.a. "cv"). The reason for this is because the header is reusing the same code that declares XSFUNCTION (which needs an identifier). cc barfs when it reaches the cast.

    I took a look at the XSUB.h in 5.8.8, and sure enough it's been corrected to not include an identifier. I must not be the first person with this problem :)

    If you are unfortunate enough to not be able to upgrade your version of perl for some reason and you still need or want to get this to work here's what you can add at the beginning of your XS file to fix things:

    #undef XSINTERFACE_FUNC #define XSINTERFACE_FUNC(ret,cv,f) ((ret (*)())(f))

    And that's all folks. Thanks for the advice :)

Re^3: perlxs INTERFACE problem
by syphilis (Archbishop) on Nov 15, 2007 at 13:01 UTC
    Yeah it's the same compiler

    Seems an odd error to be getting. I just tried it out on linux and it all works fine there, too.

    What version of perl are you running ? I notice, too, that my C file is being generated by ExtUtils::ParseXS-2.17. Maybe that's the key to success ?

    Update: Then again ... on linux, the C file was generated by xsubpp-1.9508.

    Cheers,
    Rob