I tried the HelloWorld addon sample (using node 4.4.3 for windows) and found that node-gyp sets following defines in the generated VS solution (besides others):
BUILDING_V8_SHARED=1
BUILDING_UV_SHARED=1
BUILDING_NODE_EXTENSION
While BUILDING_NODE_EXTENSION is clear the other two seem to be strange because of following statement in v8.h:
// Setup for Windows DLL export/import. When building the V8 DLL the
// BUILDING_V8_SHARED needs to be defined. When building a program which uses
// the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
// static library or building a program which uses the V8 static library neither
// BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
build configuration to ensure that at most one of these is set
#endif
#ifdef BUILDING_V8_SHARED
# define V8_EXPORT __declspec(dllexport)
#elif USING_V8_SHARED
# define V8_EXPORT __declspec(dllimport)
#else
# define V8_EXPORT
#endif // BUILDING_V8_SHARED
In case I first include node.h this seems to be "repaired" via following statements in node.h:
#ifdef BUILDING_NODE_EXTENSION
# undef BUILDING_V8_SHARED
# undef BUILDING_UV_SHARED
# define USING_V8_SHARED 1
# define USING_UV_SHARED 1
#endif
But if I first include v8.h or other V8 files like v8-profiler.h the corrections done in node.h are missing.
I think that USING_V8_SHARED=1 and USING_UV_SHARED=1 should be set instead BUILDING_V8_SHARED=1 and BUILDING_UV_SHARED=1 for node extensions.
I tried the HelloWorld addon sample (using node 4.4.3 for windows) and found that node-gyp sets following defines in the generated VS solution (besides others):
While BUILDING_NODE_EXTENSION is clear the other two seem to be strange because of following statement in v8.h:
In case I first include node.h this seems to be "repaired" via following statements in node.h:
But if I first include v8.h or other V8 files like v8-profiler.h the corrections done in node.h are missing.
I think that
USING_V8_SHARED=1andUSING_UV_SHARED=1should be set insteadBUILDING_V8_SHARED=1andBUILDING_UV_SHARED=1for node extensions.