share buffer object between javascript and native addon that write by c++?
<p>node version: v5.1.1
os: window7 x86</p>

<p>can i share buffer object between javascript and native addon that write by c++? </p>

<p>try belowing, but failed;</p>

<p>c++ addon code:</p>

<pre><code>void setBuffer(const v8::FunctionCallbackInfo&lt;v8::Value&gt;&amp; args) {
    Isolate* isolate = args.GetIsolate();
    char* jsBuffer = node::Buffer::Data(Local&lt;Object&gt;::Cast(args[0]));
    memcpy(jsBuffer, "bbbbbbbbbb", 10);
    printf("native addon output:%s\n", jsBuffer);
}
</code></pre>

<p>javascript code:</p>

<pre><code>var native = require('nativeAddon');
var globalBuffer = new Buffer(20).fill('a');
native.setBuffer(globalBuffer); //set globalBuffer to 'bbbbbb....', using memcpy
console.log("js output:" + globalBuffer);
</code></pre>

<p>result:</p>

<p>native addon output: bbbbbbbbbbaaaaaaaaaaaaaaaa</p>

<p>js output: aaaaaaaaaaaaaaaaaaaaaaaaaa</p>

<p>but, globalBuffer not change, why?</p>