Subj : Re: C embedding question: failure in JS_DefineFunction To : Pavel Podgoretsky From : Brendan Eich Date : Tue Mar 18 2003 11:03 am Pavel Podgoretsky wrote: >Hi Brendan, > >Sorry I wasn't specific enough. FindConstructor returns null, which is >propagated up the stack and eventually JS_DefineFunction returns null. >There are no other errors. > As you say below, that's because you generated a silent failure -- a false or null return without a prior JS_Report*Error* or JS_SetPendingException call. Just being clear here (please correct me if I've misread you). >BUT while I was writing up a few more details for you, I found the problem! >Thank you! :) > >The JSClass structure that I use needs a getObjectOps member (countrary to >what the api docs say!), and that member has to return a non-null >JSObjectOps. [There is an access violation otherwise.] > That shouldn't be the case. As you can see from all the JSClass static initializers in the engine (date_class, js_ObjectClass, etc.), getObjectOps may be null. Can you say more about *why* you seem to need a non-null JSClass.getObjectOps initializer? Where exactly (file and line, and with what stack backtrace) do you crash when you use a null initializer? /be > Since I didn't know >what some of those should do, I just had them return JS_FALSE. At some >point, lookupProperty was called [looking for 'Function', for some strange >to me reason] and returned JS_FALSE instead of setting its outparams to null >and returning JS_TRUE. (If I recall correctly, the very helpful comments in >jspubtd.h were not as helpful when I wrote that code originally...) > >Thank you for your extremely prompt response. > >-Pavel > > > > .