in reply to Re^4: SWIG and conflicting definitions
in thread SWIG and conflicting definitions

You could use

#undef XSPROTO #define XSPROTO(name) void name(pTHX_ struct cv* cv)
This should be compatible with the typedef. An incomplete type declaration
struct cv;
can't hurt either, though that shouldn't be necessary. Try this without that sneaky #define CV ...

However, your boot_pwiz_swigbindings takes two arguments, whereas SWIG_init is expected to take one. Something needs a fix there as well.

Replies are listed 'Best First'.
Re^6: SWIG and conflicting definitions
by hexcoder (Curate) on Jan 08, 2016 at 22:54 UTC
    I agree mostly. Using
    #include "perl.h" #include "XSUB.h" #undef XSPROTO #define XSPROTO(name) void name(pTHX_ struct cv* cv)
    instead of
    #define CV __perl_CV #include "perl.h" #include "XSUB.h" #undef XSPROTO #define XSPROTO(name) void name(pTHX_ __perl_CV* cv) #undef CV
    is much more elegant and better. But both variants should work.

    However SWIG_init is declared with two parameters.

    In 'SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);' macro 'pTHHXo_' expands to 'PerlInterpreter*,'.

    With the comma at the end there are suddenly two parameters.
Re^6: SWIG and conflicting definitions
by jdv (Sexton) on Jan 09, 2016 at 06:01 UTC

    This worked!

    #include "EXTERN.h" #include "perl.h" #include "XSUB.h" /* These lines are needed to avoid collisions */ #undef XSPROTO #define XSPROTO(name) void name(pTHX_ struct cv* cv)

    Despite the additional caveats given by you and hexcoder, adding just those last two lines as suggested allowed things to compile without error, and I tested the resulting module/library with a basic call and got the expected response. There's still a lot of work to do cleaning up the interface and getting it to use existing system libraries instead of pulling everything into the module shared object file, but I'm willing to spend the time now that I know the basics work.

    Thanks to both of you for the help. I'd give you both more upvotes if I could.