Skip to content

Commit d61451e

Browse files
Update headers from nodejs/node tag v20.2.0 (#27)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 99db75a commit d61451e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/node_api.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct uv_loop_s; // Forward declaration.
3030

3131
typedef napi_value(NAPI_CDECL* napi_addon_register_func)(napi_env env,
3232
napi_value exports);
33+
typedef int32_t(NAPI_CDECL* node_api_addon_get_api_version_func)();
3334

3435
// Used by deprecated registration method napi_module_register.
3536
typedef struct napi_module {
@@ -54,11 +55,20 @@ typedef struct napi_module {
5455
#define NAPI_MODULE_INITIALIZER_BASE napi_register_module_v
5556
#endif
5657

58+
#define NODE_API_MODULE_GET_API_VERSION_BASE node_api_module_get_api_version_v
59+
5760
#define NAPI_MODULE_INITIALIZER \
5861
NAPI_MODULE_INITIALIZER_X(NAPI_MODULE_INITIALIZER_BASE, NAPI_MODULE_VERSION)
5962

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+
6067
#define NAPI_MODULE_INIT() \
6168
EXTERN_C_START \
69+
NAPI_MODULE_EXPORT int32_t NODE_API_MODULE_GET_API_VERSION() { \
70+
return NAPI_VERSION; \
71+
} \
6272
NAPI_MODULE_EXPORT napi_value NAPI_MODULE_INITIALIZER(napi_env env, \
6373
napi_value exports); \
6474
EXTERN_C_END \

0 commit comments

Comments
 (0)