Subj : how to implement a function with JSString return value and called from javascript? To : netscape.public.mozilla.jseng From : twmt Date : Mon May 16 2005 04:59 pm hello, everyone. I am using spidermonkey, and want to implenment such a javascript: ....... ... ... foo() is the native C function called from javscript. I want foo() return a string, so I define JSString *foo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval). and JS_DefineFunction(context, global, "foo", foo, 1, 0); But the compiler complainted that: passing JSString * (*)(JSContext *, JSObject *, unsigned int, jsval *, jsval *) as argument 4 of 'JS_DefineFunction(JSContext *, JSObject *, const char *, JSBool (*)(JSContext *, JSObject *, unsigned int, jsval *, jsval *), unsigned int, unsigned int)'. Does this mean the functions called from javascript should be JSBool type? and how can I get a JSString return value? Thanks! -- Regards twmt .