Subj : Function reserved slots To : netscape.public.mozilla.jseng From : Alain Frisch Date : Thu May 19 2005 04:14 pm Hello, I'm new to SpiderMonkey embedding; please accept my apologies if the question is stupid. I want to define a new native function and attach some custom data to its associated object, to be used within the C callback. I've read that the object associated to a function has two reserved slots which can be used for this purpose. Here is what I do to create the function: JSFunction *func; func = JS_DefineFunction(cx, globalObj, "trampoline", trampoline, 3, 0); JS_SetReservedSlot(cx,JS_GetFunctionObject(func),0,INT_TO_JSVAL(1000)); In the trampoline function, I'm trying to acces the reserved slot: jsval v; ok = JS_GetReservedSlot(cx,obj,0,&v); This last call fails. What did I do wrong? Thanks. -- Alain Frisch .