Eventually, we want to be able to fatpack code into a single executable file. For this, we need some way to get data out of the executable.
We could of course nativecall into our own process, but that gets a bit more dicey if we want to package NativeCall itself.
It's proably a better idea to provide a proper interface such as a C function
int MVM_vm_register_resource(MVMInstance *instance, const char *c_name, const void *bytes, size_t size)
and an op
loadres (str NAME, obj TYPE, int64 COPY?) --> obj NEW_OBJECT
If COPY?
is 0, TYPE
must have representation CArray
, CStruct
, etc. If we do make a copy,
we allow additional representations, in particular VMArray
.
This is supposed to unlock the following use case:
CompUnit::Loader.load-precompilation:
nqp::loadres('Foo::Bar:auth<dummy>:ver<0.1>', blob8.self, 1);