http://qs321.pair.com?node_id=385343

Nalina has asked for the wisdom of the Perl Monks concerning the following question:

Hey monks,

As per ur suggestions to my earlier thread 'embed perl in C', I installed free Borland 5.5 C/C++ compiler. I copied 'extern.h' & 'perl.h' header files from 'C:\perl\Lib\Core' to 'C:\borland\BCC5\include' directory. My perl embedded C code is
#include <EXTERN.h> /* from the Perl distribution */ #include <perl.h> /* from the Perl distribution */ static PerlInterpreter *my_perl; /* The Perl interpreter */ int main(int argc, char **argv, char **env) { my_perl = perl_alloc(); perl_construct(my_perl); perl_parse(my_perl, NULL, argc, argv, (char **)NULL); perl_run(my_perl); perl_destruct(my_perl); perl_free(my_perl); }
When I compiled this program I got the following errors
E:\>bcc32 perl_inc.c Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland perl_inc.c: Error E2209 c:\Borland\Bcc55\include\perl.h 37: Unable to open include + file 'config.h' Error E2209 c:\Borland\Bcc55\include\perl.h 475: Unable to open includ +e file 'embed.h' Error E2209 c:\Borland\Bcc55\include\perl.h 490: Unable to open includ +e file 'strings.h' Error E2257 c:\Borland\Bcc55\include\perl.h 1078: , expected Error E2257 c:\Borland\Bcc55\include\perl.h 1079: , expected Error E2257 c:\Borland\Bcc55\include\perl.h 1271: , expected Error E2257 c:\Borland\Bcc55\include\perl.h 1751: , expected Error E2209 c:\Borland\Bcc55\include\perl.h 1807: Unable to open inclu +de file 'handy.h' Error E2209 c:\Borland\Bcc55\include\perl.h 1971: Unable to open inclu +de file 'unixish.h' Error E2139 c:\Borland\Bcc55\include\perl.h 2287: Declaration missing +; Error E2139 c:\Borland\Bcc55\include\perl.h 2288: Declaration missing +; Error E2139 c:\Borland\Bcc55\include\perl.h 2290: Declaration missing +; Error E2293 c:\Borland\Bcc55\include\perl.h 2302: ) expected Error E2209 c:\Borland\Bcc55\include\perl.h 2325: Unable to open inclu +de file 'iperlsys.h' Fatal F1003 c:\Borland\Bcc55\include\regexp.h 18: Error directive: Mus +t use C++ for REGEXP.H *** 15 errors in Compile ***
Then I just copied all the required header files(only those which are not found in borland include folder) from 'C:\perl\lib\core' directory to 'c:\borland\bcc5\include' directory.

After copying I still am getting errors like
E:\>bcc32 perl_inc.c Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland perl_inc.c: Error E2303 c:\Borland\Bcc55\include\win32.h 314: Type name expected Error E2293 c:\Borland\Bcc55\include\win32.h 413: ) expected Error E2293 c:\Borland\Bcc55\include\perlio.h 105: ) expected Error E2293 c:\Borland\Bcc55\include\perlio.h 106: ) expected Error E2293 c:\Borland\Bcc55\include\perlio.h 108: ) expected Error E2293 c:\Borland\Bcc55\include\perlio.h 110: ) expected Error E2141 c:\Borland\Bcc55\include\perlio.h 111: Declaration syntax +error Error E2293 c:\Borland\Bcc55\include\perlio.h 112: ) expected Error E2293 c:\Borland\Bcc55\include\perlio.h 214: ) expected Error E2293 c:\Borland\Bcc55\include\perlio.h 227: ) expected Error E2303 c:\Borland\Bcc55\include\perlio.h 339: Type name expected Error E2303 c:\Borland\Bcc55\include\perlio.h 342: Type name expected Error E2293 c:\Borland\Bcc55\include\perlio.h 345: ) expected Error E2293 c:\Borland\Bcc55\include\perlio.h 354: ) expected Error E2293 c:\Borland\Bcc55\include\perlio.h 358: ) expected Error E2293 c:\Borland\Bcc55\include\perlio.h 365: ) expected Error E2293 c:\Borland\Bcc55\include\perlio.h 370: ) expected Error E2303 c:\Borland\Bcc55\include\win32iop.h 73: Type name expected Error E2303 c:\Borland\Bcc55\include\win32iop.h 74: Type name expected Error E2303 c:\Borland\Bcc55\include\win32iop.h 77: Type name expected Error E2303 c:\Borland\Bcc55\include\win32iop.h 133: Type name expecte +d Error E2238 c:\Borland\Bcc55\include\perl.h 1775: Multiple declaration + for 'AV' Warning W8017 c:\Borland\Bcc55\include\dosish.h 137: Redefinition of ' +Stat' is not identical Error E2257 c:\Borland\Bcc55\include\perl.h 2075: , expected Error E2257 c:\Borland\Bcc55\include\perl.h 2076: , expected Error E2257 c:\Borland\Bcc55\include\perl.h 2077: , expected Error E2228 c:\Borland\Bcc55\include\perl.h 2077: Too many error or wa +rning messages *** 26 errors in Compile ***
Can I use borland C/C++ compiler for embedding perl in to C? If I can not which compiler(freeware) should I use for this purpose?

Is there any other way I can embed perl script in to C & C in to perl?

Thanks in advance