Subj : Re: beginner question spidermonkey To : netscape.public.mozilla.jseng From : Sterling Bates Date : Thu Sep 02 2004 07:11 pm (I just received this today, but the date was August 26...?) "marian simon" wrote in message news:ch83nk$d741@ripley.netscape.com... > static JSBool getName (JSContext *cx, JSObject *obj, uintN argc, jsval > *argv, jsval *rval) > { > char *name; > > name=ele->get_name(); //not good ?? > printf("get_Name() name = %s obj=0x%x argc=%d \n",name,obj,argc); > > return JS_TRUE; > } I'm not sure if this is a typo, but you're not setting *rval to the actual name. Brendan'll correct me if I'm wrong, but you probably want this: JSString *str; str = JS_NewString(cx, name, strlen(name)); *rval = STRING_TO_JSVAL(str); strlen() may not be right, but I don't recall C[++]'s string length function :) Also, it may not be right to create a new JSString for every function call, but aside from making that a property of the object I don't know any C solutions. Sterling .