Keep It Simple, Stupid | |
PerlMonks |
Re: On the road again with Gtk2 and PAR::Packerby bliako (Monsignor) |
on Feb 14, 2019 at 10:21 UTC ( [id://1229904]=note: print w/replies, xml ) | Need Help?? |
I have been climbing the "perl embedding and static linking" learning curve for some time now and it just seems that there is some logic behind what my first impression was, madness. And of course I now see opportunities to use static/embedded Perl everywhere. Your case for example... If you are really desperate to get that working, then you can try to create a perl.exe which contains all the libraries it needs statically resulting in a very big exe which still needs to load pure-perl modules in the usual manner (so you would still need PAR for that) but does not need to load any XS libraries. They are all in there provided that you told the linker that you will need the functions in those libraries (read on). Similar to building a static perl, you can also build statically a very basic C-Perl-embedding, see perlembed, Re: Embed perl problem and Pass signals and argv from C to embedded Perl for such program, which will load your script and execute it in the embedded perl interpreter. That means you still have your Perl program which loads up now via your own myperl.exe, instead of via perl.exe. What you achieve with that is to place in your C-program dummy statements requesting GTK and XS functions so that the linker does actually links them statically instead of scanning your C program (and not your Perl program of course, so you see now why these dummy statements are useful) for function calls and linking only those that it sees you use. This can be achieved by the newXS() call. If I am not missing the point entirely about your situation and you decide to give this option a try, then let me know and can share my experience (I am planning to do it anyway in a couple of weeks when my stuff is more stable). But to get you an idea of the workload and workflow:
ps. There are of course apps (which claim) to do static linking, like staticperl and fatpack. Maybe I have too much static (electricity, (c) BOFH) in my hands and none worked for me. bw, bliako
In Section
Seekers of Perl Wisdom
|
|