GeezerVison is showing github.com — node-api: explicitly set __cdecl for API functions · styfle/node@fb74474
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/js_native_api.h +367-363Lines changed: 367 additions & 363 deletions Large diffs are not rendered by default.
Collapse file
Copy file name to clipboardExpand all lines: src/js_native_api_types.h +13-4Lines changed: 13 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
11 | 11 | typedef uint16_t char16_t; |
12 | 12 | #endif |
13 | 13 |
|
| 14 | +#ifndef NAPI_CDECL |
| 15 | +#ifdef _WIN32 |
| 16 | +#define NAPI_CDECL __cdecl |
| 17 | +#else |
| 18 | +#define NAPI_CDECL |
| 19 | +#endif |
| 20 | +#endif |
| 21 | + |
14 | 22 | // JSVM API types are all opaque pointers for ABI stability |
15 | 23 | // typedef undefined structs instead of void* for compile time type safety |
16 | 24 | typedef struct napi_env__* napi_env; |
@@ -100,10 +108,11 @@ typedef enum { |
100 | 108 | // * the definition of `napi_status` in doc/api/n-api.md to reflect the newly |
101 | 109 | // added value(s). |
102 | 110 |
|
103 | | -typedef napi_value (*napi_callback)(napi_env env, napi_callback_info info); |
104 | | -typedef void (*napi_finalize)(napi_env env, |
105 | | - void* finalize_data, |
106 | | - void* finalize_hint); |
| 111 | +typedef napi_value(NAPI_CDECL* napi_callback)(napi_env env, |
| 112 | + napi_callback_info info); |
| 113 | +typedef void(NAPI_CDECL* napi_finalize)(napi_env env, |
| 114 | + void* finalize_data, |
| 115 | + void* finalize_hint); |
107 | 116 |
|
108 | 117 | typedef struct { |
109 | 118 | // One of utf8name or name should be NULL. |
|