I'm working on an experimental extension API, which is going
well, but I'm pondering how the GC should cooperate with
native calls.

Currently I have some code like:

# t.pasm
loadlib P0, "libpqt.so"
print "Loaded\n"
callnative P1, P0, "PQt_init"
end

/* libpqt.c */
int PQt_init(Interp * interp) {
    STRING * s;
    if(!interp) {
       fprintf(stderr, "NULL Interp!\n");
       return -1;
    }

    fprintf(stderr, "Interp has %d ops\n", interp->op_count);

    /* Get a STRING off the user stack */
    PXS_shifts(interp, s);

    /* Oops, shifting s off the Parrot stack might have been
     * removed it from the root set.
     */

}


Now there are a dozen ways to handle this. Using flags, keeping args on the
stack until return, yada yada yada...

I'd like to hear suggestions, or maybe reference to past discussions I might
have missed on how we shall handle this. Actually I want more than suggestions,
I want a voice from the sky to boom, "Go that way!"

-Melvin

Reply via email to