views:

461

answers:

2

I am looking at embedding perl 5.10 in a large C++ application compiled with VC++ 6.0. This leads to two questions.

1) Is it a bad idea to simply use Strawberry Perl as a dependency rather than compile my own perl with VC++ 6.0? Would Strawberry even work given the compiler mismatch? I presume Strawberry is compiled with mingw. I would much rather not have to keep my own custom perl build around.

2) If I went the Strawberry route, would something like Inline::C work in the embedded application? You'd have VC++ 6.0 code calling mingw compiled Strawberry in turn calling user mingw compiled code. Inline::C would be an awesome capability for what I'm trying to achieve with the embedded perl interpreter.

+3  A: 

Given the uncertainty involved, I would recommend compiling Perl using MSVC instead of experimenting with Strawberry Perl for this application. There are instructions in perlwin32 and a related discussion on Perl Monks to guide you.

As a former release manager for Strawberry Perl, I can tell you it's not terribly difficult to do if you're comfortable with a compiler already.

-- xdg

xdg
But a custom compiled win32 perl is lacking compared to Strawberry. No integrated cpan and mingw stuff. Can I easily get Inline::C working with my own win32 perl?
kingkongrevenge
Strawberry just *packages* MinGW. It's "configured" during compilation. So a custom compiled win32 perl will compile stuff from CPAN using the MSVC you compiled perl with. And "integrated" CPAN is just pre-configured CPAN. You can copy \strawberry\perl\lib\CPAN\Config.pm and adapt as needed.
xdg
But I definitely don't want to have to put MSVC on the client machines. I'd like to use a neatly packaged mingw without any license annoyances. Is it even possible to load mingw compiled object code into the MSVC compiled perl?
kingkongrevenge
+2  A: 

Activestate perl is compiled with VC++ 6.0. It can use VC++ 6.0 or MinGW to compile modules since they link to the same C runtime library, msvcrt.dll. It would be preferable to use MinGW because VC++ 6.0 is neither free nor readily available (unless you can be sure that it is installed on the target machine.) You can PPM install Mingw now, and compile modules from CPAN. A large number of modules compile without trouble. You may have to configure CPAN with:

o conf yaml_module '' (Two single quotes, nothing between)

o conf commit

Inline::C works.