Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to embed perl6 in a C (or C++) program?

Tags:

embedding

raku

In perl5 it was easy to link in libperl.so, set some variables and run some code, with callbacks. Is there a story for doing this in perl6?

like image 410
Andrew Avatar asked Jun 08 '18 22:06

Andrew


1 Answers

This isn't an answer, but suppose I've got an already existing C program which is designed to use plugins which are .dlls or .sos, and they get loaded via dlopen or LoadLibrary, an API entry point is found using dlsym or GetProcAddress, then that entry point is called with some sort of handle for the plugin to make calls back into the main process.

Now, suppose I want my plugin (inside of this .dll or .so) to load moarvm, and then run some perl6 script, which in turn uses NativeCall to call back into the main process. How would I go about doing this?

Alternatively, suppose I want my plugin (inside of this .dll or .so) to load the jvm, then run some perl6 script, etc. How would I go about doing this?

Loading perl5 just to load perl6 seems like a silly solution. It might work, but...

like image 184
BenGoldberg Avatar answered Nov 01 '22 16:11

BenGoldberg