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

Hey folks... I've tried building this module with h2xs | (swig & (MakeMaker | ModuleBuild)). It builds and is installed fine, but when i go to use it in a test script, i get this error message:
Can't find 'boot_MappedMaps' symbol in /.../MappedMaps.so at /.../MappedMaps.pm line 7 Compilation failed in require at testMappedMaps.pl line 7. BEGIN failed--compilation aborted at testMappedMaps.pl line 7.
Here's the MakeMaker Makefile.PL:
use 5.008003; use ExtUtils::MakeMaker; $CC = 'g++'; WriteMakefile ( NAME => 'MappedMaps', VERSION => '0.1.0.0', LDFROM => './MappedMaps.o', LIBS => ['-lgcc_s'], DEFINE => '-Dcplusplus', INC => '-I. -I/usr/include -I/usr/include/g++', CC => $CC, LD => $CC );
Also, here's the swig cmd-line and the h2xs cmd-line:
#swig -perl -c++ -Fstandard -v -Wall -I$(TOP_SRCDIR)/common -I/usr/inc +lude MappedMaps.i #h2xs -F'-Dcplusplus -I/usr/include/g++' MappedMaps.h -lgcc_s
I understand DynaLoader (i've got the latest & greatest) is responsible for the bootstrapping, so what's going wrong here? How can I correct it? I'd be happy to provide more details if needed...much thanks in advance!

janitored by ybiC: Balanced <code> tags around swig and h2xs command line examples, as per consideration.

-----------------------UPDATE--------------------------- ok, found the define where swig defines the following func. inside the swig _wrap code:
#define SWIG_init boot_MappedMaps
then, the definition for SWIG_init is:
XS(SWIG_init) { dXSARGS; int i; static int _init = 0; if (!_init) { for (i = 0; swig_types_initial[i]; i++) { swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]); } _init = 1; } /* Install commands */ for (i = 0; swig_commands[i].name; i++) { newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, +(char*)__FILE__); } /* Install variables */ for (i = 0; swig_variables[i].name; i++) { SV *sv; sv = perl_get_sv((char*) swig_variables[i].name, TRUE | 0x2); if (swig_variables[i].type) { SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); } else { sv_setiv(sv,(IV) 0); } swig_create_magic(sv, (char *) swig_variables[i].name, swig_va +riables[i].set, swig_variables[i].get); } /* Install constant */ for (i = 0; swig_constants[i].type; i++) { SV *sv; sv = perl_get_sv((char*)swig_constants[i].name, TRUE | 0x2); switch(swig_constants[i].type) { case SWIG_INT: sv_setiv(sv, (IV) swig_constants[i].lvalue); break; case SWIG_FLOAT: sv_setnv(sv, (double) swig_constants[i].dvalue); break; case SWIG_STRING: sv_setpv(sv, (char *) swig_constants[i].pvalue); break; case SWIG_POINTER: SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constant +s[i].ptype),0); break; case SWIG_BINARY: SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_cons +tants[i].lvalue, *(swig_constants[i].ptype)); break; default: break; } SvREADONLY_on(sv); } SWIG_TypeClientData(SWIGTYPE_p_UGA_CAGT_PGML__MappedMaps, (void*) +"MappedMaps::MappedMaps"); ST(0) = &PL_sv_yes; XSRETURN(1); }
still have the question, "why can't DynaLoader find boot_MappedMaps?" anybody?

Replies are listed 'Best First'.
Re: module builds but can't find 'boot_$modulename' symbol on use
by PodMaster (Abbot) on Aug 12, 2004 at 22:57 UTC
    It builds and is installed fine, but when i go to use it in a test script
    The compiler may have no problem with it, but perl certainly does. You should test before you install. The problem you're having is that the code you compiled doesn't contain a boot_MappedMaps symbol. That's what (function) DynaLoader calls after loading MappedMaps.so. No one can tell you why it doesn't exist (they can't see the code).

    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.

    A reply falls below the community's threshold of quality. You may see it by logging in.