http://www.perlmonks.org?node_id=1198789


in reply to Compiling C program with a Static Perl

I need it that way for distribution purposes where no Perl or LibYAML can be installed

Is this a policy or technical limit?

If this a technical limit, then maybe a ZIP file could be used for distribution. The ZIP would contain your program, Perl and all the dependencies needed.

(If your situation requires an installer, there are ways to convert a ZIP file into an installer.)

(Although my primary PC runs Linux, I've only ever setup self-contained ZIP distributions for MS Windows, but this is possible with Linux, MacOS and others.)

For MS Windows, I have started with the portable edition of Strawberry Perl. After downloading and unzipping to a folder, go to that folder and run portableshell.bat

Then you can use the cpan command to install any dependencies from CPAN. You can copy any libraries your C program needs to the lib folder under the c folder.

Once you have your program running in this environment, make a copy of portableshell.bat to yourprogram.bat and customize yourprogram.bat to run your program. If you have several programs, you can make customized copies of portableshell.bat for each.

Test that your yourprogram.bat file(s) launch your program(s) correctly and everything is still running correctly.

Zip the folder containing yourprogram.bat and the dependencies. On a PC with without Perl or your program, unzip the zip file and test your program(s). If everything still works correctly, you now have a ZIP file to distribute.