Sep 30, 2009, 9:34 AM
Post #1 of 1
Embedding Perl and C
I am a newbie to perl and know nothing of Perl.
I want to embed perl in my C code.I work on Visual Studio in Windows.
The perl code should do something like this.
1. It should ask for user on command line to input 2 xml files and then it should handover the names of these files to my C code which will do post processing on the contents of these files.
2. The perl code should also be able to call my C functions based on the number entered on command line by the user.
I have referred the document perlembed.pod and tried to execute the code in section "Maintaining a persistent interpreter" in visual studio C++ environment. But the output is not as expected in the document.The test.pl is never executed.
I will just give a glimpse of what I want to do
static PerlInterpreter *my_perl = NULL;
int _tmain(int argc, _TCHAR* argv)
UInt8 char * arg1,*arg2;
//Execute some C code over here.
// Allocate a perl interpreter memory and then perl code should wai +t on DOS prompt for user to enter the file names and these file names would be asssigned to arg1 and arg2.
Now My C code will do processing on contents of these files.
// And also I should be able to call some C functions from a perl script code.something like this number = perlgetnumber();// Number pressed by the user. //Call some Functions based on the number. // Deallocate the perl interpretr memory and quit. }
Can anybody in the group give me Embedded (C and Perl) code. It will take a lot of effort to learn and do it. or else atleast a skeleton code to go ahead.
Please dont give me the link to Manning book which mentions about Embdding perl.
Please guide me.
Thanks in Advance.