On Sun, 27 Apr 2008, [EMAIL PROTECTED] wrote: > I'm developing an app that is embedding perl for some web scarping. I > developed an perl extension that has to callback into my C++ code > while running inside embedded interpreter. If I dynamically link the > perl extension as a .dll then the xsub in the perl extension gets > called correctly and does what I need it to do. > > However, if I statically link the perl extension and then link that > with my Visual C++ app with the embedded perl interpreter inside, my > xsub never gets called ?? The linking process completes and there are > no unresolved external symbols. But when my perl code calls the xsub I > get an error message saying 'undefined subroutine' in perl.
If you are using the mechanism from win32/Makefile, then you must make sure you add your extension to the list in STATIC_EXT to make sure it gets initialized properly. Otherwise you need to add some code to your xs_init() function to define the bootstrap function in your module via newXS("MyExt::boot_MyExt", boot_MyExt, __FILE__); and then make sure you call MyExt::boot_MyExt() manually before calling any function from MyExt(). The BOOT section in the XS code is responsible for registering all the XS functions at the Perl level. Cheers, -Jan