/*test.c*/ #include /* from the Perl distribution */ #include /* from the Perl distribution */ #include #include static PerlInterpreter *my_perl; /*** The Perl interpreter ***/ static char *perl_args[] = { "", "-e", "0", "-w" }; static char perl_script[] = { "use IO::Socket;\n" "my $sock = new IO::Socket::INET or die qq/Can't create socket!/;\n" "print qq/Done\n/;" }; extern void xs_init _((void)); extern void boot_DynaLoader _((CV * cv)); void xs_init () { char *file = __FILE__; /* this allows using dynamicaly loaded modules... see perlembed manpage*/ newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); } int main(int argc, char **argv, char **env) { setlocale (LC_ALL, ""); fprintf(stderr,"Locale value for NUMERIC is %s\n",setlocale(LC_NUMERIC,NULL)); my_perl = perl_alloc(); perl_construct(my_perl); perl_parse(my_perl, xs_init, 4, perl_args, (char **)NULL); perl_eval_pv(perl_script,(I32) NULL); perl_destruct(my_perl); perl_free(my_perl); exit(0); }