On Tuesday, January 9th, 1996 - Evan Langlois wrote:
EL> I actually don't have any good examples - I'd have to look them up.
EL> Here is an example - this is actually part of the 'miniperl' C code.
EL> It contains the code to start up the interpretter and do its thing,
EL> wind up adding most (or maybe even all) of PERL into your C code,
EL> #include "EXTERN.h"
EL> #include "perl.h"
EL> static void xs_init _((void));
EL> static PerlInterpreter *my_perl;
EL> int main(argc, argv, env)
EL> int argc;char **argv;char **env;
EL> {
EL> int exitstatus;
EL> perl_construct( my_perl ); }
EL> perl_destruct( my_perl );
EL> perl_free( my_perl );
EL> exit( exitstatus );
EL> }
I'd say that's a pretty good example! :-)
EL> via this XSUB
EL> void Call_fred()
EL> CODE:
EL> PUSHMARK(sp) ; perl_call_pv("fred", G_DISCARD|G_NOARGS)
EL> ;
EL> fprintf(stderr, "back in Call_fred\n") ;
EL> I wish I knew how the above works, as you can see, it defined some
EL> C stuff, but yet, it isn't C (note the lack of braces!). There are
If it isn't C and it isn't PERL, what the heck is it???
--- RiBBS v2.10
[+/197 of 200/106 Mins] = * FIDO: ST_PROG =: Next...
* Origin: Permanent Crew Rest (206)472-6805 (1:138/245.0)
|