laziness, impatience, and hubris | |
PerlMonks |
Re: Need help using Inline::Module with JavaScript::Embeddedby syphilis (Archbishop) |
on Jul 14, 2022 at 02:57 UTC ( [id://11145511]=note: print w/replies, xml ) | Need Help?? |
I want to compile the C library in JavaScript::Embedded at install time, not every time it is used. Ok ... apply this patch (or make the specified changes by hand) to Embedded.pm. Update: Patch corrected to remove errant whitespace. (Thanks LanX.) I've assumed that $Config{installsitelib} always exists, and is writable. I think those are fairly safe assumptions. The thing is that, in order to avoid the re-compilation issue, you need to assign a specific directory as Inline's build directory. Setting of the "build_noisy" and unsetting of the "clean_after_build" config options is not really needed - they just make things a little clearer. (IMO, "build_noisy" should be set by default.) Unsetting the "clean_after_build" option allows us to go into the build directory and view the XS and C files that Inline::C generated. Otherwise, those files are deleted when the build has been completed. If, having built the module, you go into the $Config{installsitelib}/_Inline/build/JavaScript/Embedded directory and locate the XS file (in the "Vm_a662" subdirectory on my build) generated from duk_perl.c you'll see that the standard perl headers (EXTERN.h, perl.h and XSUB.h) have been included twice. Also, Inline::C does not handle PERL_NO_GET_CONTEXT and might also not handle NO_XSLOCKS (I don't know). Both PERL_NO_GET_CONTEXT and NO_XSLOCKS need to be declared before the standard perl headers - and that clearly is not happening. None of this is causing any breakage, but I recommend that you apply the following changes to duk_perl.c for clarity: If you really want to effectively define PERL_NO_GET_CONTEXT, then we'll need to say goodbye to Inline::C and switch to XS. For that, I would be using my own InlineX::C2XS (which uses Inline::C) to generate the XS file(s). Are you happy enough with just those changes to Embedded.pm and duk_perl.c ? ... or do we need to go further ? Cheers, Rob
In Section
Seekers of Perl Wisdom
|
|