From:  "Dave Huseby" <dave@linuxprogrammer.org>
Date:  19 Oct 2006 04:45:10 Hong Kong Time
Newsgroup:  news.mozilla.org/netscape.public.mozilla.jseng
Subject:  

Re: JS_DefineFunction

NNTP-Posting-Host:  130.76.32.144

> ...or even better, if there is a way to pass a user pointer
> to a function and get it back when the C function is called?

You can use the JS_SetPrivate and JS_GetPrivate functions to set/get a
user pointer on the object that the JS function is associated with.
The object the JS function is associated with is the one you passed
into the JS_DefineFunction function.  When your C function gets called,
it is passed a context and the object that the JS function was
associated with.  You would use JS_GetPrivate to get your pointer back
which inside the C function.

Dave