I'm exploring ways to build a plugin system for an existing large C++ program. Embedding perl might be one good way to achieve this. The embedded perl could eval user code/modules to alter behavior.
However, it's absolutely critical that the user plugins can bring compiled code with them, i.e. code that is not already linked in the executable. Plugins would occasionally be doing some computationally intensive stuff internally where pure Perl wouldn't cut it. Is this possible?
My understanding is that to use object code from the perl hosting process you have to generate the xs_init code and link in the resulting object file. Is there some black magic way to support this by manually hacking the xs_init? No multi-process solutions are acceptable, though the perl hosting process is free to re-exec itself during some initialization stage; all the plugins to use would be known at start-up.
This might boil down to more of an operating systems question than a Perl question. Are there any ways to tell an executable to arbitrarily "load" an object file? DLL-Injection/LD_PRELOAD? I'm fairly ignorant of these things, if you can't tell.