Hello,
Sorry if this is an obvious question, but I'm trying to pass a native c++ 
data pointer through when setting up a function template for access within 
a callback.
 
So for example in the code below, if I wanted to pass 'buffer' through for 
use within the LogCallback, what is the best way to achieve it?
 
static char buffer[1024];
Handle<ObjectTemplate> global = ObjectTemplate::New();
global->Set(String::New("log"), FunctionTemplate::New(LogCallback));
 
Looking at FunctionTemplate I see this constructor is available...
 
static Local<FunctionTemplate> New(
      FunctionCallback callback = 0,
      Handle<Value> data = Handle<Value>(),
      Handle<Signature> signature = Handle<Signature>(),
      int length = 0);
 
So do I have to wrap this buffer pointer into a Handle<Value>() somehow and 
supply it as the 2nd data argument?
 
Then I could get the value back using the Data() method of the AccessorInfo?
 
class PropertyCallbackInfo {
 public:
   V8_INLINE(Local<Value> Data() const);
  V8_INLINE(Local<Object> This() const);
  V8_INLINE(Local<Object> Holder() const);
Or perhaps I'm on the wrong track...?
 
Thanks,
Mark.
 

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to