Subj : [SpiderMonkey]Simple Code To : netscape.public.mozilla.jseng From : ma2thieul Date : Fri Jul 02 2004 08:34 am Hello, I've a problem with my code based on the one of Brendan Eich in "How to start up the VM and Execute a script". I did this: JSRuntime * rt; JSContext * cx; JSObject * global; rt = JS_NewRuntime(0x100000); if(rt) { cx = JS_NewContext(rt, 0x1000); if(cx) { JSClass global_class = { "global",0, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub}; global = JS_NewObject(cx, &global_class, NULL, NULL); JS_InitStandardClasses(cx, global); char * script="document.write('hello');"; jsval rval; JSString * str; JSBool ok; char * filename; uintN lineno; ok = JS_EvaluateScript(cx, global, script, strlen(script), filename, lineno, &rval); //JSScript * compiled = JS_CompileScript(cx, global, script, strlen(script), filename, lineno); //ok = JS_ExecuteScript(cx, global, compiled, &rval); if (ok==JS_TRUE) { str = JS_ValueToString(cx, rval); } } } The JS_EvaluateScript function returns JS_FALSE. Do you see why? I just want that my program returns hello. Thank you very much for any help. Matthieu PS: Excuse my English. I hope you have understood. .