Thanks. In fact I'm using the similar way now.
I also want to make the copy more smart, because I don't want to know the
type when I copying. I want to use the class v8::Value directly. For
example:
When I trying to pass some javascript function parameter to my lower layer
api in addon.
void js_fun('abc', 5); I'd like to pass the string 'abc' and integer 5 to
my lower api, void addon_fun(const char*, int). Before calling the
addon_fun, I'd like to store the parameters to someplace. And I want to use
a similar structure like Arguments to store all the parameters. Then I'd
like to have some kind of abstract class like v8:Value to store string,
integer or double, any types in a vector.
On Friday, April 12, 2013 6:39:55 AM UTC+8, Ben Noordhuis wrote:
>
> On Thu, Apr 11, 2013 at 4:54 PM, Jerry Yin <[email protected]<javascript:>>
> wrote:
> > I think I would like to copying the Value and store the Value to a place
> > that other thread can access. But I don't know how to make that kind of
> > copy.
> > Below is my case:
> > I have some other thread in the addon, and I have to call some APIs on
> those
> > thread. The parameters I'm using to call those API come from the
> javascript.
> > I just want to copy those parameters, for instance, copying v8:String,
> > v8:Int32
> >
> > Do you have any code examples on copying those value, so any other
> thread
> > can access them at any time.
>
> int32_t num = val->Int32Value();
> String::Utf8Value str(val);
> char* copy = strdup(*str);
> // etc.
>
> The add-ons documentation has more snippets you can look at.
>
--
--
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.