Subj : Re: Passing context and object to shared library To : netscape.public.mozilla.jseng From : Brendan Eich Date : Tue Sep 23 2003 07:21 pm u wrote: >Hello, > >We have a Linux application that programmatically loads shared >libraries/objects (SO's) that contain javascript engine code. The idea was that our application creates the javascript interp and passes contexts and objects to the SO, which would then create more objects, etc, in that interp. > > There's no problem doing this. Mozilla does similar things, and MozillaClassic (the old Nescape 5 code open-sourced in '98) did too. >However, if I link the SO and the executable with the javascript shared >library, the SO bails in JS_DefineObject (which is using contexts and >objects passed from the app) with "Assertion Failure: OBJ_IS_NATIVE(pobj), >AT JSOBJ.C:1765". If I link the application the same way, but >with -rdynamic, and don't link the SO with the javascript shared library, >everything works as expected. > >I can think of reasons why this would fix problems, but it seemed unexpected >that I should have to do this. Should I have been surprised by this >behavior? I'm not trying to do anything fancy with multiple interps or >mixing contexts or anything. > >I am using JavaScript 1.5 - rc5a. > This has nothing to do with the JS engine, and everything to do with your GNU toolchain. What version of gcc are you using? Of binutils? What are *all* the command line options used when compiling? When linking? When building a .so file? /be .