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.


In reply to Re: Compiling C program with a Static Perl by RonW
in thread Compiling C program with a Static Perl by rodd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.