Skip to content

Commit 037ff3d

Browse files
vmorozBethGriggs
authored andcommitted
node-api: explicitly set __cdecl for API functions
PR-URL: #42780 Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent c535db1 commit 037ff3d

6 files changed

Lines changed: 973 additions & 908 deletions

File tree

‎src/js_native_api.h‎

Lines changed: 367 additions & 363 deletions
Large diffs are not rendered by default.

‎src/js_native_api_types.h‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
typedefuint16_tchar16_t;
1212
#endif
1313

14+
#ifndefNAPI_CDECL
15+
#ifdef_WIN32
16+
#defineNAPI_CDECL __cdecl
17+
#else
18+
#defineNAPI_CDECL
19+
#endif
20+
#endif
21+
1422
// JSVM API types are all opaque pointers for ABI stability
1523
// typedef undefined structs instead of void* for compile time type safety
1624
typedefstructnapi_env__*napi_env;
@@ -100,10 +108,11 @@ typedef enum {
100108
// * the definition of `napi_status` in doc/api/n-api.md to reflect the newly
101109
// added value(s).
102110

103-
typedefnapi_value (*napi_callback)(napi_envenv, napi_callback_infoinfo);
104-
typedefvoid (*napi_finalize)(napi_envenv,
105-
void*finalize_data,
106-
void*finalize_hint);
111+
typedefnapi_value(NAPI_CDECL*napi_callback)(napi_envenv,
112+
napi_callback_infoinfo);
113+
typedefvoid(NAPI_CDECL*napi_finalize)(napi_envenv,
114+
void*finalize_data,
115+
void*finalize_hint);
107116

108117
typedefstruct {
109118
// One of utf8name or name should be NULL.

0 commit comments

Comments
 (0)