How to return Handle<Value> from Native C++ Module?

29 views
Skip to first unread message

NodeNinja

unread,
Sep 23, 2016, 12:14:35 PM9/23/16
to nodejs
node version : v0.12.12

I was porting some legacy code to nodev0.12.12 using node nan.
The ported work seemed to work when I built it on a 32bit system.
Now I have upgraded to a 64bit system and I getting an error in the build.


NAN_METHOD(BigInt::BitLength)
{
   
NanScope();
   
BigInt *bigint = ObjectWrap::Unwrap<BigInt>(args.This());


    size_t size
= mpz_sizeinbase(*bigint->bigint_, 2);

   
Handle<Value> result = NanNew(size);  // <= error: call of overloaded ‘NanNew(size_t&)’ is ambiguous

   
NanReturnValue(result);
}

My question is how do I return a Handle<Value> using node/nan?

Fedor Indutny

unread,
Sep 24, 2016, 5:18:50 PM9/24/16
to nod...@googlegroups.com
Hello!

Have you tried `NanNew<Value>`?

Thanks,
Fedor.

--
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+unsubscribe@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/933ddddb-4269-4204-97ee-890963460e53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

NodeNinja

unread,
Oct 3, 2016, 9:10:07 AM10/3/16
to nodejs, fe...@indutny.com
Hi Fedor, 
you mean something like this right?

Handle<Value> result = NanNew<Value>(size); 

will check up and see if this works?

On Sunday, September 25, 2016 at 2:48:50 AM UTC+5:30, Fedor Indutny wrote:
Hello!

Have you tried `NanNew<Value>`?

Thanks,
Fedor.
On Fri, Sep 23, 2016 at 3:53 AM, NodeNinja <aeon...@gmail.com> wrote:
node version : v0.12.12

I was porting some legacy code to nodev0.12.12 using node nan.
The ported work seemed to work when I built it on a 32bit system.
Now I have upgraded to a 64bit system and I getting an error in the build.


NAN_METHOD(BigInt::BitLength)
{
   
NanScope();
   
BigInt *bigint = ObjectWrap::Unwrap<BigInt>(args.This());


    size_t size
= mpz_sizeinbase(*bigint->bigint_, 2);

   
Handle<Value> result = NanNew(size);  // <= error: call of overloaded ‘NanNew(size_t&)’ is ambiguous

   
NanReturnValue(result);
}

My question is how do I return a Handle<Value> using node/nan?

--
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.
Reply all
Reply to author
Forward
0 new messages