Subj : Re: How to return JSString from a C Function? To : netscape.public.mozilla.jseng From : "F. Lucto" Date : Fri Aug 29 2003 08:26 am Thank you for your quick reply!. The JS_NewUCStringCopyZ function did the trick. Cheers, Frank "Gunda Kries" wrote in message news:3f4f0528$0$31817$9b622d9e@news.freenet.de... > > function a() > > { > > myString = MyCFunction(); > > > > return myString > > } > > > > What does a C function have to look like in order to return a JSString > > rather than a JSBool? > Two things: > 1) The return value is transported with the pointed jsval (jsval *rval > mostly), the boolean return on c level decides, if the function call itself > worked well (e.g. for error breaks). > 2) JavaScript has an internal string format, you have to create a js string > first and cast it to jsval the. E.g.: > (*rval)=STRING_TO_JSVAL(JS_NewStringCopyZ(lpContext,"my string")); > > return (JS_TRUE); > > Hope this helps, > Andreas "SunSailor" Podgurski > > > > .