Created
August 12, 2015 13:33
-
-
Save ghaiklor/baf48d481128413d6dd8 to your computer and use it in GitHub Desktop.
NodeJS macros for registering native modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, priv, flags) \ | |
extern "C" { \ | |
static node::node_module _module = \ | |
{ \ | |
NODE_MODULE_VERSION, \ | |
flags, \ | |
NULL, \ | |
__FILE__, \ | |
NULL, \ | |
(node::addon_context_register_func) (regfunc), \ | |
NODE_STRINGIFY(modname), \ | |
priv, \ | |
NULL \ | |
}; \ | |
NODE_C_CTOR(_register_ ## modname) { \ | |
node_module_register(&_module); \ | |
} \ | |
} | |
#define NODE_MODULE_CONTEXT_AWARE_BUILTIN(modname, regfunc) \ | |
NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, NM_F_BUILTIN) \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment