Ioannis Mavroidis <[EMAIL PROTECTED]> writes:
>Thanks a lot for your help! Both things you suggested (using a
>non-threaded
>perl which I could find, or putting the "dTHX") worked and I got an
>executable.
>The problem that I'm running in now is the following:
>% a.out
>Can't load module Thread, dynamic loading not available in this perl.
>  (You may need to build a new perl executable which either supports
>  dynamic loading or has the Thread module statically linked into it.)
> at test.pl line 11
>Compilation failed in require at test.pl line 11.
>
>The perl program I'm trying to execute from within C does a "use
>Thread;"

Obviously that is only going to work with a 5005-style threaded perl.

>at line 11 which fails. I believe that the only solution would be to
>build a new perl, but I'm hoping I might be missing something that
>someone
>will gracefully point out...

In your C app which embeds perl you need to "build in" dynamic linking if
you want it - same way perl does:

>> >
>> >      7 void perl_init () {
>> >      8     char *args[] = { "perl", "-e", "exit;" };
>> >      9     printf("C: Initializing Perl interpreter\n");
>> >     10
>> >     11     my_perl = perl_alloc();
>> >     12     perl_construct(my_perl);
>> >     13
>> >     14     perl_parse (my_perl, NULL, 3, args, (char **)NULL);

Change that to:
               
                perl_parse(my_perl, xs_init, 3, args, (char **)NULL);


>> >     15     perl_eval_pv ("require 'test.pl';", TRUE);
>> >     16 }
>> >

And add:


static void
xs_init(pTHX)
{
    char *file = __FILE__;
    dXSUB_SYS;
        newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
}

You will also need to link against the right library e.g.

lib/auto/DynaLoader/DynaLoader.a



-- 
Nick Ing-Simmons

Reply via email to