I've seen other people complaining about this exact same error plastered all
over the internet, but I haven't seen an answer to it yet. Arggggg!!!
I'm trying to compile the short and simple "persistent.c" program below but
I keep getting the "undefined reference to `boot_DynaLoader'" error message.
I'm trying this on Red Hat Linux 9.
Thanks for any help!!!!
Joe
//-----------------------------------------------------------------
***Actual command I'm using to compile the program:
gcc -I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/ -L
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/ libperl.so persistent.c
***Actual error message I get back:
/tmp/cc6wZroJ.o(.text+0x11): In function `xs_init':
: undefined reference to `boot_DynaLoader'
collect2: ld returned 1 exit status
//-----------------------------------------------------------------
//persistent.c
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>
#include "perlxsi.c"
static PerlInterpreter *my_perl = NULL;
int main(int argc, char *argv[])
{
int exitstatus = 0;
char* command_line[] = { "", "-e", "printf \"Hello from C!\\n\";" };
char code[2048]="\0";
if((my_perl = perl_alloc()) == NULL) {
fprintf(stderr, "no memory!");
exit(1); }
perl_construct(my_perl);
exitstatus = perl_parse(my_perl, xs_init, 3, command_line, (char **)NULL);
if(!exitstatus) {
exitstatus = perl_run(my_perl);
}
perl_destruct(my_perl);
perl_free(my_perl);
exit(exitstatus);
return 0;
}
//------ End of Persistent.c -----------------------------
//------- Beginning of perlxsi.c -------------------------
#include <EXTERN.h>
#include <perl.h>
EXTERN_C void xs_init (pTHX);
EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
EXTERN_C void
xs_init(pTHX)
{
char *file = __FILE__;
dXSUB_SYS;
/* DynaLoader is a special case */
newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
}
//-------------------------------------------------------------
//End.