8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0e507d3 commit b55adfbCopy full SHA for b55adfb
src/js_native_api.h
@@ -28,7 +28,7 @@
28
#ifndef NAPI_EXTERN
29
#ifdef _WIN32
30
#define NAPI_EXTERN __declspec(dllexport)
31
-#elif defined(__wasm32__)
+#elif defined(__wasm__)
32
#define NAPI_EXTERN \
33
__attribute__((visibility("default"))) \
34
__attribute__((__import_module__("napi")))
src/node_api.h
@@ -1,11 +1,11 @@
1
#ifndef SRC_NODE_API_H_
2
#define SRC_NODE_API_H_
3
4
-#ifdef BUILDING_NODE_EXTENSION
+#if defined(BUILDING_NODE_EXTENSION) && !defined(NAPI_EXTERN)
5
6
// Building native addon against node
7
#define NAPI_EXTERN __declspec(dllimport)
8
9
#define NAPI_EXTERN __attribute__((__import_module__("napi")))
10
#endif
11
@@ -17,8 +17,13 @@ struct uv_loop_s; // Forward declaration.
17
18
#define NAPI_MODULE_EXPORT __declspec(dllexport)
19
#else
20
+#ifdef __EMSCRIPTEN__
21
+#define NAPI_MODULE_EXPORT \
22
+ __attribute__((visibility("default"))) __attribute__((used))
23
+#else
24
#define NAPI_MODULE_EXPORT __attribute__((visibility("default")))
25
26
+#endif
27
#if defined(__GNUC__)
#define NAPI_NO_RETURN __attribute__((noreturn))
@@ -49,7 +54,7 @@ typedef struct napi_module {
49
54
NAPI_MODULE_INITIALIZER_X_HELPER(base, version)
50
55
#define NAPI_MODULE_INITIALIZER_X_HELPER(base, version) base##version
51
56
52
-#ifdef __wasm32__
57
+#ifdef __wasm__
53
58
#define NAPI_MODULE_INITIALIZER_BASE napi_register_wasm_v
59
60
#define NAPI_MODULE_INITIALIZER_BASE napi_register_module_v
@@ -143,7 +148,6 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_get_buffer_info(napi_env env,
143
148
void** data,
144
149
size_t* length);
145
150
146
-#ifndef __wasm32__
147
151
// Methods to manage simple async operations
152
NAPI_EXTERN napi_status NAPI_CDECL
153
napi_create_async_work(napi_env env,
@@ -159,7 +163,6 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_queue_async_work(napi_env env,
159
163
napi_async_work work);
160
164
NAPI_EXTERN napi_status NAPI_CDECL napi_cancel_async_work(napi_env env,
161
165
162
-#endif // __wasm32__
166
167
// version management
168
@@ -197,7 +200,6 @@ napi_close_callback_scope(napi_env env, napi_callback_scope scope);
197
200
198
201
#if NAPI_VERSION >= 4
199
202
203
// Calling into JS from other threads
204
205
napi_create_threadsafe_function(napi_env env,
@@ -231,7 +233,6 @@ napi_unref_threadsafe_function(napi_env env, napi_threadsafe_function func);
231
233
232
234
235
napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func);
236
237
#endif // NAPI_VERSION >= 4
238