Very simply I don't have a 'use Data::Dumper' line in my script
but when later on doing 'print Dump $myvar' I get no error!
Also when doing 'print Dumperrrrrrrrrr $myvar' I get no error too!
Why is that???????
|
boot_DynaLoader: what, where, how
2 direct replies — Read more / Contribute
|
by rodd
on Mar 23, 2024 at 09:26
|
Respectable keepers of knowledge:
I'm working on binding some JS and Perl code using Bun FFI (https://bun.sh/docs/api/ffi) and perlembed. Things work good, except for XS dynamic loading. Probably due to the way the Bun FFI links to the boot_DynaLoader in my libperl.so, and the general lack of tools and knowledge on my part to circumvent, emulate or recode some of those parts.
So, my question: where or how in core is the libperl boot_DynaLoader C function defined? I just can't find it! I've been to the Perl core code and docs on XS, boot_DynaLoader and ExtUtils::Embed, but to my surprise I can't figure how it works or where its code resides in core (my core is 5.22.1).
Any leads, links or pointers to help me acquire the knowledge of the inner workings of dynamic loading would be of great help.
PD: I didn't want to bore you with my code, but here it is, for context:
const xsInit = new JSCallback(
(pTHX) => {
Perl.Perl_newXS(
perl,
pstr('DynaLoader::boot_DynaLoader'),
Perl.boot_DynaLoader.ptr,
pstr(import.meta.file)
);
},
{ args: ['ptr'] }
);
const rc = Perl.perl_parse(perl, xsInit.ptr, argc, argv, envp);
The above does not dynamic loads XS modules as intended due to the way the FFI library exports symbols, which are meant primarily to be used within the JS realm, not to be sent back to libperl as a callback or (void *)() pointers. I've tried some other workarounds and practices, ie using my own compiled xs_init() function from C and FFI linking to that, but loading is still not working. I probably will be able to solve it at some point, but still, I'd like to understand the inner workings of the core in that regard. I got it working on darwin x86 by accident, but the same workaround fails in linux.
|