Subj : SpiderMonkey: implement property of type object with get/set methods To : netscape.public.mozilla.jseng From : "Yuraukar" Date : Fri Sep 26 2003 07:29 pm I am trying to integrate the SpiderMonkey engine into my C++ application. Of course, I will need to wrap my objects, so they are accessible from JavaScript code. I worked myself through the basics of http://home.tiscali.be/franky.braem17/spidermonkey.htm and other helpful articles. However, I fail to achieve the following task: I have a class Customer that has a reference to a class Account, e.g. class Customer { ... int nID; Account account; ... }; I would like to have this as a property in JavaScript, so the following code becomes valid: c = new Customer(); a = c.account; I am stuck at the code for the property getter (e.g. JSGetProperty). What am I supposed to write to return an existing C++ instance as a result? ..... p = (Customer*)JS_GetPrivate(cx, obj); ..... case prop_id: *vp = INT_TO_JSVAL(p->nID); break; case prop_account: *vp = ???????; // anyhow return &(p->account) here break; .... Any examples or hints? I would not like to go via JS_DefineObject, as in reality the situation is slightly more complicated. Yuraukar. .