Subj : Re: about defining object... To : Youngsun Jeong From : Brendan Eich Date : Tue Sep 30 2003 04:22 pm Youngsun Jeong wrote: >Next, I add JSFunction "my_plusAge()" to my_class. > > How do you do that, exactly? >"my_plusAge()" is ; > >static JSBool >my_plusAge(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, >jsval *rval) >{ > jsval jsval_age = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE); > > Stop right there! ;-) You should *not* be including jsobj.h or any file other than jsapi.h, or if you need only the API's public typedefs, jspubtd.h. > int age = JSVAL_TO_INT(jsval_age); > int added = JSVAL_TO_INT(argv[0]); > int sum = age + added; > > *rval = INT_TO_JSVAL(sum); > > return JS_TRUE; > >} > >But.."my_plusAge" is not working. I want to know how do make the >relation between "age" and "plusAge()". And how "myobject" is defined? > > You haven't shown any code that defines properties in the prototype sure the class, or in each instance of the class. >Please help me! > > You need to show more code. /be .