Unwrap a newly created `ObjectWrap` from `FunctionCallbackInfo`

55 views
Skip to first unread message

Gautham Badhrinathan

unread,
May 27, 2014, 7:40:36 PM5/27/14
to nod...@googlegroups.com

I have an Object that extends node::ObjectWrap as follows:

class DNSServiceRefWrap : public node::ObjectWrap {
public:
    DNSServiceRefWrap();
    static void New(const v8::FunctionCallbackInfo<v8::Value> &args);
private:
    ~DNSServiceRefWrap();
    DNSServiceRef *ref;
}

In a method that I'm exporting through module.exports, I have:

void RegisterService(const FunctionCallbackInfo<Value> &args) {
    Isolate* isolate = Isolate::GetCurrent();
    HandleScope scope(isolate);

    DNSServiceRefWrap::New(args);
    // Over here
}

How do I unwrap and access the newly created DNSServiceRefWrap object here?

Note: I'm using node v0.11.13.

Cross posted on StackOverflow.

Nathan Rajlich

unread,
May 29, 2014, 1:33:16 AM5/29/14
to nodejs
Sorry for not answering the question directly, but I'd highly recommend that you use nan (https://github.com/rvagg/nan) when writing your native addons. It ensures node compatibility for older versions as well as future ones, and has a slightly more pleasant to use API than V8's.

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 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 unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/9e1441f8-7b87-4974-8ac8-57fe4c1e6c8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages