Import classes from a packfile

Bart Wiegmans bartwiegmans at gmail.com
Mon Aug 20 12:00:27 UTC 2012


Hi everybody, again,

Never mind I fixed it.

The solution, here to be reported for eternity to come, is to:

* load Parrot_pf_prepare_packfile_init as a NCI function (vpP), of
library null because the symbol is already loaded
* and call it with the interpreter pmc and the PackfileView PMC,
* the configuration of the NCI function makes sure the interpreter
pmcs' get_pointer vtable is called, which gives the pointer to the
underlying Parrot_Interp structure, and the second expected argument
is in fact a pointer to the PackfileView PMC.
* PROFIT

Also, this should be an opcode of some sort.

Kind regards,
Bart

2012/8/20 Bart Wiegmans <bartwiegmans at gmail.com>:
> Hi everybody,
>
> In short, I want Parrot_api_ready_bytecode for PackfileViewPMC, in winxed / pir.
>
> Kind regards,
> Bart
>
> 2012/8/20 Bart Wiegmans <bartwiegmans at gmail.com>:
>> Hi everybody,
>>
>> I'm having the following situation in mod_parrot:
>>
>> * I load a compiler (winxed in this case)
>> * And I compile some source code
>> * After which I receive a PackfileView.
>> * The script that was compiled to the PackFileView defines a class
>> (and maybe some subroutines)
>> * But I cannot instantiate this class.
>>
>> Now I can inspect this packfile perfectly and get its' subroutines.
>> However, what I want to do for mod_parrots' advanced routing is
>> instantiating a class (by name) and invoking a method on it.
>> However, the packfileview in question isn't 'really' loaded into the
>> parrot interpreter, and as such, classes defined in the script cannot
>> be instantiated by the interpreter.
>>
>> How to fix this?
>>
>> I hope to hear from you.
>> Kind regards,
>> Bart


More information about the parrot-dev mailing list