Skip to content

Commit

Permalink
node-api: explicitly set __cdecl for API functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoroz committed Apr 25, 2022
1 parent 2691222 commit 7434911
Show file tree
Hide file tree
Showing 6 changed files with 973 additions and 908 deletions.
730 changes: 367 additions & 363 deletions src/js_native_api.h

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions src/js_native_api_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
typedef uint16_t char16_t;
#endif

#ifndef NAPI_CDECL
#ifdef _WIN32
#define NAPI_CDECL __cdecl
#else
#define NAPI_CDECL
#endif
#endif

// JSVM API types are all opaque pointers for ABI stability
// typedef undefined structs instead of void* for compile time type safety
typedef struct napi_env__* napi_env;
Expand Down Expand Up @@ -100,10 +108,11 @@ typedef enum {
// * the definition of `napi_status` in doc/api/n-api.md to reflect the newly
// added value(s).

typedef napi_value (*napi_callback)(napi_env env, napi_callback_info info);
typedef void (*napi_finalize)(napi_env env,
void* finalize_data,
void* finalize_hint);
typedef napi_value(NAPI_CDECL* napi_callback)(napi_env env,
napi_callback_info info);
typedef void(NAPI_CDECL* napi_finalize)(napi_env env,
void* finalize_data,
void* finalize_hint);

typedef struct {
// One of utf8name or name should be NULL.
Expand Down
Loading

0 comments on commit 7434911

Please sign in to comment.