@crossbind/core-embind-jsi 2.0.0-beta.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Copyright 2020 The Emscripten Authors. All rights reserved.
3
+ * Emscripten is available under two separate licenses, the MIT license and the
4
+ * University of Illinois/NCSA Open Source License. Both these licenses can be
5
+ * found in the LICENSE file.
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #define EMSCRIPTEN_KEEPALIVE __attribute__((used))
11
+
12
+ #ifdef __wasm__
13
+ #define EM_IMPORT(NAME) __attribute__((import_module("env"), import_name(#NAME)))
14
+ #else
15
+ #define EM_IMPORT(NAME)
16
+ #endif
17
+
18
+ /*
19
+ * EM_JS_DEPS: Use this macro to declare indirect dependencies on JS symbols.
20
+ * The first argument is just unique name for the set of dependencies. The
21
+ * second argument is a C string that lists JS library symbols in the same way
22
+ * they would be specified in the DEFAULT_LIBRARY_FUNCS_TO_INCLUDE command line
23
+ * setting.
24
+ *
25
+ * For example, if your code contains an EM_ASM or EM_JS block that make use of
26
+ * the allocate and stackSave JS library functions then you might write this in
27
+ * your library source code:
28
+ *
29
+ * EM_JS_DEPS(mylib_dep, "$allocate,$stackSave");
30
+ *
31
+ * The emscripten linker will then pick this up and make sure those symbols get
32
+ * included in the JS support library.
33
+ *
34
+ * Dependencies declared in this way will be included if-and-only-if the object
35
+ * file (translation unit) in which they exist is included by the linker, so
36
+ * it makes sense co-locate them with the EM_JS or EM_ASM code they correspond
37
+ * to.
38
+ */
39
+ #define EM_JS_DEPS(tag, deps) \
40
+ EMSCRIPTEN_KEEPALIVE \
41
+ __attribute__((section("em_lib_deps"))) \
42
+ __attribute__((aligned(1))) \
43
+ char __em_lib_deps_##tag[] = deps;