I'm trying to embed perl in a C++ application and have some perl modules
call back into the C++. I cannot figure out how to make the bootstrap
work on my callback module. When I eval "use Callback;" I get "Can't
locate loadable object for module Callback in @INC" even though the
Callback stuff is linked in. It shouldn't be looking for a .so file.
The DynaLoader stuff works fine for other modules.
Here's what I got:
Makefile:
OBJS = main.o perlxsi.o callbackxs.o
...
main : $(OBJS) # my callbackxs.o should link in here fine, right?
$(CC) -o $@ $^ $(PERLLD)
callbackxs.o : callback.xs
xsubpp callback.xs > callbackxs.cpp
$(CC) -c callbackxs.cpp $(PERLCXX) # compiles fine.
...
perlxsi.c:
EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
EXTERN_C void boot_Callback (pTHX_ CV* cv);
EXTERN_C void
xs_init(pTHX)
{
char *file = const_cast<char*>( __FILE__ );
dXSUB_SYS;
newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
newXS("Callback::boot_Callback", boot_Callback, file);
}
main.cpp:
perl_parse(my_perl, xs_init, arg_count, const_cast<char**>(args),
NULL); # dynaloader works fine
I can see "XS(boot_Callback)" defined just fine in the code spat out by
xsubpp on my xs file.
What gives? What's the missing step to tell perl about linked in module
code?