Hi all,

Looking for some help with my understanding of C++ addon callbacks. Within 
my C++ binding (Foo), I have a function (Bar) that is called from another 
thread (not a node one). I'd like to have this function to perform a 
MakeCallback on some function within js land. I've create a persistent 
context within Foo::New such as

Foo* foo = new Foo(options);
foo->on = Persistent<Object>::New(Object::New());
args.This()->Set(String::New("on"), foo->on);

The foo object is also forwarded within the thread via a void* handle, and 
used back later in Bar function such as follow:

void Foo::Bar(void* handle, const char* data) {
  Foo* foo = static_cast< foo*>(handle);
  assert(handle != NULL);
  assert(foo != NULL);
  assert(data != NULL);

  Local<Value> args[1] = { String::New(data) };
  node::MakeCallback(foo->on, "myevent", 1, args);
}

Now, probably because I'm missing something about scope and such, it seems 
I can't perform the callback nor even create a Local<Value> at all 
(segfault)

Any enlightenment, pointer, or ideas would be gladly appreciated.

Cheers!

Pascal

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" 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