yeap your right i have a activestate distribution , under c:\perl
Then you could do the following:
1) Start Visual C++, open your project
2) in
[Tools]->Options->|Directories|
choose "Include Files" (Show Directories for ...)
and add
C:\Perl\lib\CORE
in the empty line below the other lines
3) in
[Tools]->Options->|Directories|
choose "Library Files" (Show Directories for ...)
and add
C:\Perl\lib\CORE
in the empty line below the other lines
4)in
[Project]->Settings->|Link|
choose Category "General"
and find the line "Object/Library modules"
at the end of the stuff add (delimited by space): perl58.lib
press ok
Then save all your project settings. You are now
able to inlucde the Perl-interpreter into your
program.
Now write the following code (for testing):
...
#include <stdio.h>
#include <EXTERN.h>
#include <perl.h>
...
PerlInterpreter *my_perl;
static char *embedding[] = { "", "-e", "0" };
int main(int argc, char **argv, char **envp)
{
int i;
SV * s_pre;
PERL_SYS_INIT3( &argc, &argv, &envp );
my_perl = perl_alloc();
perl_construct( my_perl );
perl_parse(my_perl, 0, 3, embedding, envp);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);
rbuffer = new char [64000];
// write some program arguments to Perl (see what happens)
for(i=1; i<argc; i++) {
sprintf(rbuffer,"push @ARGV,'%s';", argv
);
s_pre = eval_pv( rbuffer, TRUE );
}
perl_destruct( my_perl );
perl_free ( my_perl );
PERL_SYS_TERM();
return 0;
}
If that compiles and runs, you are through.
Next step:
Write sime Perl programs "in place", like
const char someprogram[] =
{
" print \"Perl loaded o.k.\"; \n"
" print \" <== \", Perl $] on $^O \"\\n\"; \n"
"1;"
};
and invoke by:
...
s_pre = eval_pv( someprogram, TRUE );
if( SvIV(s_pre) != 1 ) {
perror("test prog didn't execute\n");
exit(-1);
}
...
or load another perl source file (do ...) from there.
But one step after the other ;-)
Regards
M.