in reply to Embedding Perl Interpreter/DynaLoader

Thanks for your help - I've arrived at some new questions as a result!

1) "perl -MExtUtils::Embed -e ccopts -e ldopts" does not work for me when I use it to pass parameters to my cc statement. The cc compiler complains of many unknown options. I took a look at the Config.pm file, and it references the gcc compiler. I don't believe we have that installed on our UNIX server - perhaps the admins loaded a precompiled binary of Perl, rendering ExtUtils useless for me in this fashion?

2) I did use ExtUtils to produce an xsinit.c file, as follows:

perl -MExtUtils::Embed -e xsinit -- -o xsinit.c -std
But I can not compile this. When I try
cc xsinit.c codeGen.c -o codeGen -L/lib/pa1.1 -L/usr/local/lib -I/usr/ +local/include -I/opt/perl/lib/5.6.1/PA-RISC1.1-t hread-multi/CORE -L/opt/perl/lib/5.6.1/PA-RISC1.1-thread-multi/auto/Dy +naLoader/DynaLoader.a -L/opt/perl/lib/5.6.1/PA-RISC1.1-threa d-multi/CORE -L/opt/perl/lib/5.6.1/PA-RISC1.1-thread-multi/CORE/libper +l.so -lmalloc -ldld -ldld -lperl -lm -lsec -lnsl -lnm -lpthr ead -lc -lndir -lcrypt -Dbool=char -DHAS_BOOL
(gruesome, I know - I've tried to link/add every possible library) I get the following:
xsinit.c: codeGen.c: /usr/ccs/bin/ld: Unsatisfied symbols: boot_DynaLoader (first referenced in xsinit.o) (code)
My goal is to compile "codeGen.c", which contains an embedded Perl interpreter. What should I be loading in order to use boot_DynaLoader w/o compile problems? I can't think of any more directories to include.

3) this problem only seems to arise when I attempt to use glob(). What is it about that function that would result in these errors?

Thanks again good monks- I very much appreciate the help

MatthewFrancis

Replies are listed 'Best First'.
Re: Re: Embedding Perl Interpreter/DynaLoader
by mpeppler (Vicar) on Dec 01, 2003 at 23:26 UTC
    Here's your error:
    -L/opt/perl/lib/5.6.1/PA-RISC1.1-thread-multi/auto/DynaLoader/DynaLoad +er.a
    This tells the linker to add this directory to the directories to search for files to link.

    Remove the -L and you should be fine.

    Michael

Re: Re: Embedding Perl Interpreter/DynaLoader
by Beechbone (Friar) on Dec 01, 2003 at 23:32 UTC
    Embedding Perl into a program will usually only work if Perl and the other program are compiled with the same compiler. Try compiling your own Perl for embedding...

    About the dynaloader, I think there was an example how to include it somewhere in the embed PODs, it's just 2 or 3 lines of additional C code. But I cannot find it right now, sorry.


    Search, Ask, Know