Closed
Description
- Node.js Version: v10.7.0
- OS: Windows
XP, 7, 8, 8.1, 10 all x64 - Scope: code
- Module: node-gyp
var myModule = require('../build/release/mymodule.node');
global.b = 123;
(function(){
var a = 5;
myModule();
console.log(a, b, global.b); // Should print: 7, 8, 123
})();
myModule
is a C++ module that is a function, which should be able to access local scope of the function from where it is called (like eval
) and modify value of a
(set it to 7
) and also create local (not global) variable b
with value 8
. How to do that?
Calling myModule
should be equivalent of calling eval('a=7;var b=8')
. Basically, is there a way to access parent scope variable list and modify it directly from v8?
Many thx.
Metadata
Metadata
Assignees
Labels
No labels