I used to do this to get a program of an external class in c:
... push_text("Someclass"); SAFE_APPLY_MASTER("resolv", 1);
if (((struct svalue *)(Pike_sp - 1))->type != PIKE_T_PROGRAM) { Pike_error("Could not resolv program Someclass.\n"); } prog = ((struct svalue *)(Pike_sp - 1))->u.program;
The reason you run into a problem is probably that the program you attempt to resolve uses the parent pointer, so you get a T_FUNCTION rather than a T_PROGRAM. For what purpose do you need the program pointer? For some purposes, program.c:program_from_svalue() may return something you can use. You may also want to have a look at object.c:parent_clone_object().
I added a print_svalue for debugging and is gives me the name of the program i was looking up. Printing its type gives me type 4 (T_FUNCTION). Now I tried using program_from_svalue but it gives me the following error:
Parent lost, cannot clone program. /usr/lib/pike/modules/Public.pmod/Parser.pmod/JSON2.pmod/module.pmod:0: Public.Parser.JSON2->parse("Parent lost, cannot clone program.\n")
Is that because the parse function is not running in object context?