Subj : Re: [spidermonkey] JS_CallFunction in Finalize To : netscape.public.mozilla.jseng From : franck Date : Mon Aug 29 2005 11:40 am Brendan Eich wrote: > Franck wrote: > >> "Brendan Eich" a écrit dans le message de news: >> det4m6$7o22@ripley.aoltw.net... >> >>> BTW, there's no need to require .Proc('MessageBoxA') if you would >>> rather allow just .MessageBoxA instead. >>> >> >> >> I need to do this because I define a 'Close' function on my Module >> class :/ > > > > I was making an independent comment ("BTW" for "By the way"): you don't > need .Proc at all, whether or not you have .Close as a method. Replacing .Proc('MessageBoxA') with .MessageBoxA, you are talking about defining getProperty of the JSClass, right ? But if the dll has a symbol named 'Closed', I cannot make the difference between the dll's symbol and the Close method of my Module class. > > Here I'm assuming you are implementing in C or C++. Is the Module class > not implemented in C? It sure looked like it from the Finalize hook you > showed previously. Yes, it's C. > > Ok, so you have to share objects (share the one JSRuntime) with wxJS -- > but why must onClose be scripted? It would be best to keep it all in C. Yes, I see, in a classical 'native to javascript' binding, everything is written in C, and only some js functions and js classes are exposed to the end-user. My library is intented to be a binding to ANY dll/so, I don't know in advance the behavior of these dll/so. Some of them, like kernel32.dll, user32.dll, zlib.dll, ... don't need any destroy or finalize step before being unloaded from memory. However, wxJS.dll need wxJS_Destroy() to be called, libxml2.dll need xmlCleanupParser() to be called before being unloaded from memory ... People that use my library are 'advanced' users that know the C prototype of the function they are binding to javascript. End-users do not have to know anything about the C interface or the cleanup steps, they just have to know how to use the javascript side of the binding. My wish is to make the work as simple as possible for these end-users, for exemple, the only thing they have to do to use libxml2.dll is : -- start -- Load( 'libxml2.js' ); InitLibxml2(); .... < here they can start to use the library > -- end -- It is up to the advanced user to write the libxml2.js file ( using my library API ) > > /be ( I hope that the aim of my library is clear enough ) .