File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ struct uv_loop_s; // Forward declaration.
30
30
31
31
typedef napi_value (NAPI_CDECL* napi_addon_register_func)(napi_env env,
32
32
napi_value exports);
33
+ typedef int32_t (NAPI_CDECL* node_api_addon_get_api_version_func)();
33
34
34
35
// Used by deprecated registration method napi_module_register.
35
36
typedef struct napi_module {
@@ -54,11 +55,20 @@ typedef struct napi_module {
54
55
#define NAPI_MODULE_INITIALIZER_BASE napi_register_module_v
55
56
#endif
56
57
58
+ #define NODE_API_MODULE_GET_API_VERSION_BASE node_api_module_get_api_version_v
59
+
57
60
#define NAPI_MODULE_INITIALIZER \
58
61
NAPI_MODULE_INITIALIZER_X (NAPI_MODULE_INITIALIZER_BASE, NAPI_MODULE_VERSION)
59
62
63
+ #define NODE_API_MODULE_GET_API_VERSION \
64
+ NAPI_MODULE_INITIALIZER_X (NODE_API_MODULE_GET_API_VERSION_BASE, \
65
+ NAPI_MODULE_VERSION)
66
+
60
67
#define NAPI_MODULE_INIT () \
61
68
EXTERN_C_START \
69
+ NAPI_MODULE_EXPORT int32_t NODE_API_MODULE_GET_API_VERSION () { \
70
+ return NAPI_VERSION; \
71
+ } \
62
72
NAPI_MODULE_EXPORT napi_value NAPI_MODULE_INITIALIZER (napi_env env, \
63
73
napi_value exports); \
64
74
EXTERN_C_END \
You can’t perform that action at this time.
0 commit comments