in reply to Embedding perl and exposing xs functions

Add
static void xs_init (pTHX); EXTERN_C void boot_DynaLoader (pTHX_ CV* cv); EXTERN_C void boot_Module (pTHX_ CV* cv); EXTERN_C void xs_init(pTHX) { char *file = __FILE__; dXSUB_SYS; /* DynaLoader is a special case */ newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); newXS("Module::bootstrap", boot_Module, file); }
Change
perl_parse(my_perl, NULL, argc, argv, (char **)NULL);
to
perl_parse(my_perl, xs_init, argc, argv, (char **)NULL);
And then try
C:\>interp -e "Module::bootstrap();Module::say()"
and it should work :)(the dynaloader stuff is just there to show where I got it from, perlembed of course)

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re^2: Embedding perl and exposing xs functions
by BUU (Prior) on Dec 19, 2005 at 19:34 UTC
    Oh god, that's so obvious now that you've told me. I must have read that section a dozen times. Much thanks!