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


Hi all,

I need to embed perl (5.6.0) functions into a C application (called interp.c) but I have compile error. From my C code I call a perl function which uses 3 external modules Data, Spreadsheet and Getopt. I have already installed those modules before. Linux is the working environment.
First I generated xsinit.c file by:

perl -MExtUtils::Embed -e xsinit -- -o xsinit.c -std Data Spreadsheet +Getopt

then compiling and linking everything by:

cc -c xsinit.c `perl -MExtUtils::Embed -e ccopts` cc -c interp.c `perl -MExtUtils::Embed -e ccopts` cc -o interp interp.o xsinit.o `perl -MExtUtils::Embed -e ldopts`

but the last command returns the following error:

xsinit.o: In function `xs_init': xsinit.o(.text+0x14): undefined reference to `boot_Data' xsinit.o(.text+0x2c): undefined reference to `boot_Spreadsheet' xsinit.o(.text+0x44): undefined reference to `boot_Getopt' collect2: ld returned 1 exit status
It seems to me that I would need to link xsinit.o with archive Data.a Spreadsheet.a and Getopt.a but I don't have such files anywhere like could be for Socket.a !!!!!
What can I do ? Is there a way to generate .a files from those modules ?

Many thanks,
Luke

Replies are listed 'Best First'.
Re: Embed Perl into C using external modules...compile error !!!
by MZSanford (Curate) on Mar 05, 2002 at 11:16 UTC