kingkongrevenge has asked for the wisdom of the Perl Monks concerning the following question:
I compile XS code to object code and link it in with my executable that has an embedded perl. The XS code call functions declared in the main executable; it's a callback module. The perl can't see my linked in module. When I "use Callback;" it dies looking for Callback.pm on the disk. If I make a Callback.pm and have it xsloader-bootstrap 'Callback' it dies looking for the .so. I have the proper boot functions in xs_init.
I'm quite lost. I got valid Callback.xs code that compiles fine to object code. I got "EXTERN_C void boot_Callback (pTHX_ CV* cv);" setup in the xs_init function, along with DynaLoader (which works fine). I got the perl in my main executable working fine and linking with my XS object code fine. But my Callback module DOESN'T WORK! Perl just keeps looking for stuff on the disk. How do I tell perl it doesn't need to do that?
This is all C++ using g++, if it matters.
Makefile: ... main : Callback.o ... $(CC) -o $@ $^ $(PERLLD) Callback.o : Callback.xs xsubpp Callback.xs > Callback.c $(CC) -c Callback.c $(PERLCXX)
Update: Got it working. All I had to do was add to the C++ code eval_pv("Callback::boot_Callback();", true);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: embedded perl using linked in XS modules
by ikegami (Patriarch) on Feb 11, 2009 at 03:57 UTC | |
by kingkongrevenge (Scribe) on Feb 11, 2009 at 15:45 UTC | |
by ikegami (Patriarch) on Feb 11, 2009 at 16:03 UTC | |
by kingkongrevenge (Scribe) on Feb 11, 2009 at 16:40 UTC | |
by ikegami (Patriarch) on Feb 15, 2009 at 06:07 UTC | |
|
Re: embedded perl using linked in XS modules
by Anonymous Monk on Feb 11, 2009 at 03:40 UTC |