....
somewhere in big C program
void call_perl(void)
{
/* call perl function to do the work and trap any errors */
/* use the static (singleton) version of the perl interpreter */
my_perl = get_perl("module_init.pm");
based on SWIGs' perlmain.i
PerlInterpreter* get_perl(char *perl_file)
{
int exitstatus;
/* have we done this? */
if (NULL != my_perl) {
return my_perl;
}
char *my_argv[] = { "", perl_file };
my_perl = perl_alloc();
if (!my_perl)
exit(1);
perl_construct( my_perl );
exitstatus = perl_parse( my_perl, xs_init, 2, my_argv, (char **) N
+ULL );
if (exitstatus)
exit( exitstatus );
/* Initialize all of the module variables */
/* exitstatus = perl_run( my_perl ); */
return my_perl;
}
back to call_perl
perl_call_pv("module::sub", G_EVAL|G_DISCARD|G_NOARGS|G_VOID) ;
So far so good. I am now happily in perl land.
next:
c_exe::c_function($self->{value},$self->{channel});
This fails.
What should happen is the call gets routed through this bit of SWIG generated perl code
package c_exe;
*c_function = *c_exec::c_function;
to this c file: c_exe_wrap.c
XS(_wrap_c_function) {
{
BOW_USHORT arg1 ;
BOW_UCHAR *arg2 = (BOW_UCHAR *) 0 ;
unsigned short val1 ;
int ecode1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int argvi = 0;
BOW_SHORT result;
dXSARGS;
... a bunch of code to validate parameters ...
result = c_function(arg1,arg2);
... a bunch of code to handle return ...
}
}
But what I get is something like:
function c_exe::c_function not found at...
|