react-native-windows 0.80.5 → 0.80.6

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,79 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "JSRuntimeApi.h"
5
+
6
+ EXTERN_C_START
7
+
8
+ // Default JSR function implementations if they are not found in the engine DLL.
9
+ extern napi_status NAPI_CDECL default_jsr_open_napi_env_scope(napi_env env, jsr_napi_env_scope *scope);
10
+ extern napi_status NAPI_CDECL default_jsr_close_napi_env_scope(napi_env env, jsr_napi_env_scope scope);
11
+ extern napi_status NAPI_CDECL default_jsr_get_description(napi_env env, const char **result);
12
+ extern napi_status NAPI_CDECL default_jsr_queue_microtask(napi_env env, napi_value callback);
13
+ extern napi_status NAPI_CDECL default_jsr_drain_microtasks(napi_env env, int32_t max_count_hint, bool *result);
14
+ extern napi_status NAPI_CDECL default_jsr_is_inspectable(napi_env env, bool *result);
15
+
16
+ extern napi_status NAPI_CDECL default_jsr_create_prepared_script(
17
+ napi_env env,
18
+ const uint8_t *script_utf8,
19
+ size_t script_length,
20
+ jsr_data_delete_cb script_delete_cb,
21
+ void *deleter_data,
22
+ const char *source_url,
23
+ jsr_prepared_script *result);
24
+ extern napi_status NAPI_CDECL default_jsr_delete_prepared_script(napi_env env, jsr_prepared_script prepared_script);
25
+ extern napi_status NAPI_CDECL
26
+ default_jsr_prepared_script_run(napi_env env, jsr_prepared_script prepared_script, napi_value *result);
27
+
28
+ EXTERN_C_END
29
+
30
+ namespace Microsoft::NodeApiJsi {
31
+
32
+ namespace {
33
+
34
+ struct JSRuntimeApiNames {
35
+ #define JSR_FUNC(func) static constexpr const char func[] = #func;
36
+ #define JSR_JSI_FUNC JSR_FUNC
37
+ #define JSR_PREPARED_SCRIPT JSR_FUNC
38
+ #include "JSRuntimeApi.inc"
39
+ };
40
+
41
+ // Prepared script functions either should be all loaded or we use all default functions.
42
+ void loadPreparedScriptFuncs() {
43
+ JSRuntimeApi *current = JSRuntimeApi::current();
44
+ bool useDefault = false;
45
+ #define JSR_PREPARED_SCRIPT(func) \
46
+ decltype(::func) *loaded_##func = \
47
+ reinterpret_cast<decltype(::func) *>(current->getFuncPtr(JSRuntimeApiNames::func)); \
48
+ useDefault = useDefault || loaded_##func == nullptr;
49
+ #include "JSRuntimeApi.inc"
50
+ #define JSR_PREPARED_SCRIPT(func) \
51
+ size_t offset_##func = offsetof(JSRuntimeApi, func); \
52
+ *reinterpret_cast<decltype(::func) **>(reinterpret_cast<char *>(current) + offset_##func) = \
53
+ useDefault ? &default_##func : loaded_##func;
54
+ #include "JSRuntimeApi.inc"
55
+ }
56
+
57
+ } // namespace
58
+
59
+ thread_local JSRuntimeApi *JSRuntimeApi::current_{};
60
+
61
+ JSRuntimeApi::JSRuntimeApi(IFuncResolver *funcResolver)
62
+ : NodeApi(funcResolver)
63
+ #define JSR_FUNC(func) \
64
+ , \
65
+ func(&ApiFuncResolver<JSRuntimeApi, decltype(::func) *, JSRuntimeApiNames::func, offsetof(JSRuntimeApi, func)>:: \
66
+ stub)
67
+ #define JSR_JSI_FUNC(func) \
68
+ , \
69
+ func(&ApiFuncResolver<JSRuntimeApi, decltype(::func) *, JSRuntimeApiNames::func, offsetof(JSRuntimeApi, func)>:: \
70
+ optionalStub<&default_##func>)
71
+ #define JSR_PREPARED_SCRIPT(func) \
72
+ , \
73
+ func(&ApiFuncResolver<JSRuntimeApi, decltype(::func) *, JSRuntimeApiNames::func, offsetof(JSRuntimeApi, func)>:: \
74
+ preloadStub<&loadPreparedScriptFuncs>)
75
+ #include "JSRuntimeApi.inc"
76
+ {
77
+ }
78
+
79
+ } // namespace Microsoft::NodeApiJsi
@@ -0,0 +1,51 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #ifndef APILOADERS_JSRUNTIMEAPI_H_
5
+ #define APILOADERS_JSRUNTIMEAPI_H_
6
+
7
+ #include <js_runtime_api.h>
8
+ #include "NodeApi.h"
9
+
10
+ namespace Microsoft::NodeApiJsi {
11
+
12
+ class JSRuntimeApi : public NodeApi {
13
+ public:
14
+ JSRuntimeApi(IFuncResolver *funcResolver);
15
+
16
+ static JSRuntimeApi *current() {
17
+ return current_;
18
+ }
19
+
20
+ static void setCurrent(JSRuntimeApi *current) {
21
+ NodeApi::setCurrent(current);
22
+ current_ = current;
23
+ }
24
+
25
+ class Scope : public NodeApi::Scope {
26
+ public:
27
+ Scope(JSRuntimeApi *api) : NodeApi::Scope(api), prevJSRuntimeApi_(JSRuntimeApi::current_) {
28
+ JSRuntimeApi::current_ = api;
29
+ }
30
+
31
+ ~Scope() {
32
+ JSRuntimeApi::current_ = prevJSRuntimeApi_;
33
+ }
34
+
35
+ private:
36
+ JSRuntimeApi *prevJSRuntimeApi_;
37
+ };
38
+
39
+ public:
40
+ #define JSR_FUNC(func) decltype(::func) *const func;
41
+ #define JSR_JSI_FUNC JSR_FUNC
42
+ #define JSR_PREPARED_SCRIPT JSR_FUNC
43
+ #include "JSRuntimeApi.inc"
44
+
45
+ private:
46
+ static thread_local JSRuntimeApi *current_;
47
+ };
48
+
49
+ } // namespace Microsoft::NodeApiJsi
50
+
51
+ #endif // !APILOADERS_JSRUNTIMEAPI_H_
@@ -0,0 +1,50 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #ifndef JSR_FUNC
5
+ #define JSR_FUNC(func)
6
+ #endif
7
+
8
+ #ifndef JSR_JSI_FUNC
9
+ #define JSR_JSI_FUNC(func)
10
+ #endif
11
+
12
+ #ifndef JSR_PREPARED_SCRIPT
13
+ #define JSR_PREPARED_SCRIPT(func)
14
+ #endif
15
+
16
+ // The JS runtime functions sorted alphabetically.
17
+ JSR_FUNC(jsr_collect_garbage)
18
+ JSR_FUNC(jsr_config_enable_gc_api)
19
+ JSR_FUNC(jsr_config_enable_inspector)
20
+ JSR_FUNC(jsr_config_set_explicit_microtasks)
21
+ JSR_FUNC(jsr_config_set_inspector_break_on_start)
22
+ JSR_FUNC(jsr_config_set_inspector_port)
23
+ JSR_FUNC(jsr_config_set_inspector_runtime_name)
24
+ JSR_FUNC(jsr_config_set_script_cache)
25
+ JSR_FUNC(jsr_config_set_task_runner)
26
+ JSR_FUNC(jsr_create_config)
27
+ JSR_FUNC(jsr_create_runtime)
28
+ JSR_FUNC(jsr_delete_config)
29
+ JSR_FUNC(jsr_delete_runtime)
30
+ JSR_FUNC(jsr_get_and_clear_last_unhandled_promise_rejection)
31
+ JSR_FUNC(jsr_has_unhandled_promise_rejection)
32
+ JSR_FUNC(jsr_run_script)
33
+ JSR_FUNC(jsr_runtime_get_node_api_env)
34
+
35
+ // The JS runtime functions needed for JSI.
36
+ JSR_JSI_FUNC(jsr_close_napi_env_scope)
37
+ JSR_JSI_FUNC(jsr_queue_microtask)
38
+ JSR_JSI_FUNC(jsr_drain_microtasks)
39
+ JSR_JSI_FUNC(jsr_get_description)
40
+ JSR_JSI_FUNC(jsr_is_inspectable)
41
+ JSR_JSI_FUNC(jsr_open_napi_env_scope)
42
+
43
+ // The JS runtime functions needed for prepared script.
44
+ JSR_PREPARED_SCRIPT(jsr_create_prepared_script)
45
+ JSR_PREPARED_SCRIPT(jsr_delete_prepared_script)
46
+ JSR_PREPARED_SCRIPT(jsr_prepared_script_run)
47
+
48
+ #undef JSR_FUNC
49
+ #undef JSR_JSI_FUNC
50
+ #undef JSR_PREPARED_SCRIPT
@@ -0,0 +1,41 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "NodeApi.h"
5
+
6
+ namespace Microsoft::NodeApiJsi {
7
+
8
+ namespace {
9
+
10
+ struct NodeApiNames {
11
+ #define NODE_API_FUNC(func) static constexpr const char func[] = #func;
12
+ #include "NodeApi.inc"
13
+ };
14
+
15
+ } // namespace
16
+
17
+ LibFuncResolver::LibFuncResolver(const char *libName) : libHandle_(LibLoader::loadLib(libName)) {}
18
+
19
+ FuncPtr LibFuncResolver::getFuncPtr(const char *funcName) {
20
+ return LibLoader::getFuncPtr(libHandle_, funcName);
21
+ }
22
+
23
+ DelayLoadedApi::DelayLoadedApi(IFuncResolver *funcResolver) : funcResolver_(funcResolver) {}
24
+
25
+ DelayLoadedApi::~DelayLoadedApi() = default;
26
+
27
+ FuncPtr DelayLoadedApi::getFuncPtr(const char *funcName) {
28
+ return funcResolver_->getFuncPtr(funcName);
29
+ }
30
+
31
+ thread_local NodeApi *NodeApi::current_{};
32
+
33
+ NodeApi::NodeApi(IFuncResolver *funcResolver)
34
+ : DelayLoadedApi(funcResolver)
35
+ #define NODE_API_FUNC(func) \
36
+ , func(&ApiFuncResolver<NodeApi, decltype(::func) *, NodeApiNames::func, offsetof(NodeApi, func)>::stub)
37
+ #include "NodeApi.inc"
38
+ {
39
+ }
40
+
41
+ } // namespace Microsoft::NodeApiJsi
@@ -0,0 +1,127 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+ #ifndef APILOADERS_NODEAPI_H_
6
+ #define APILOADERS_NODEAPI_H_
7
+
8
+ #include <js_native_api.h>
9
+
10
+ namespace Microsoft::NodeApiJsi {
11
+
12
+ using LibHandle = struct LibHandle_t *;
13
+ using FuncPtr = struct FuncPtr_t *;
14
+
15
+ class LibLoader {
16
+ public:
17
+ static LibHandle loadLib(const char *libName);
18
+ static FuncPtr getFuncPtr(LibHandle libHandle, const char *funcName);
19
+ };
20
+
21
+ template <typename TApi, typename T, const char *funcName, size_t offset>
22
+ struct ApiFuncResolver;
23
+
24
+ template <typename TApi, typename TResult, const char *funcName, size_t offset, typename... TArgs>
25
+ struct ApiFuncResolver<TApi, TResult(NAPI_CDECL *)(TArgs...), funcName, offset> {
26
+ // Stub is a special function that loads the targeting function on the first call,
27
+ // replaces function pointer field with the loaded function, and executes the function.
28
+ // After this all future calls to the loaded function are going to be directly from
29
+ // the field and not use this Stub.
30
+ static TResult NAPI_CDECL stub(TArgs... args) {
31
+ using TFunc = TResult(NAPI_CDECL *)(TArgs...);
32
+ TApi *current = TApi::current();
33
+ TFunc func = reinterpret_cast<TFunc>(current->getFuncPtr(funcName));
34
+ *reinterpret_cast<TFunc *>(reinterpret_cast<char *>(current) + offset) = func;
35
+ return (*func)(args...);
36
+ }
37
+
38
+ // Optional stub tries to load target function on the first call and set it
39
+ // as the function pointer. If loading fails, then it uses provided default
40
+ // function implementation. The default function can either do the required
41
+ // work or return a failure.
42
+ template <TResult(NAPI_CDECL *defaultFunc)(TArgs...)>
43
+ static TResult NAPI_CDECL optionalStub(TArgs... args) {
44
+ using TFunc = TResult(NAPI_CDECL *)(TArgs...);
45
+ TApi *current = TApi::current();
46
+ TFunc func = reinterpret_cast<TFunc>(current->getFuncPtr(funcName));
47
+ if (func == nullptr) {
48
+ func = defaultFunc;
49
+ }
50
+ *reinterpret_cast<TFunc *>(reinterpret_cast<char *>(current) + offset) = func;
51
+ return (*func)(args...);
52
+ }
53
+
54
+ template <void (*preloadFunc)()>
55
+ static TResult NAPI_CDECL preloadStub(TArgs... args) {
56
+ using TFunc = TResult(NAPI_CDECL *)(TArgs...);
57
+ preloadFunc();
58
+ TApi *current = TApi::current();
59
+ TFunc func = *reinterpret_cast<TFunc *>(reinterpret_cast<char *>(current) + offset);
60
+ return (*func)(args...);
61
+ }
62
+ };
63
+
64
+ struct IFuncResolver {
65
+ virtual FuncPtr getFuncPtr(const char *funcName) = 0;
66
+ };
67
+
68
+ class LibFuncResolver : public IFuncResolver {
69
+ public:
70
+ LibFuncResolver(const char *libName);
71
+ FuncPtr getFuncPtr(const char *funcName) override;
72
+
73
+ private:
74
+ LibHandle libHandle_;
75
+ };
76
+
77
+ class DelayLoadedApi {
78
+ public:
79
+ DelayLoadedApi(IFuncResolver *funcResolver);
80
+ ~DelayLoadedApi();
81
+
82
+ FuncPtr getFuncPtr(const char *funcName);
83
+
84
+ DelayLoadedApi(const DelayLoadedApi &) = delete;
85
+ DelayLoadedApi &operator=(const DelayLoadedApi &) = delete;
86
+
87
+ private:
88
+ IFuncResolver *funcResolver_;
89
+ };
90
+
91
+ class NodeApi : public DelayLoadedApi {
92
+ public:
93
+ NodeApi(IFuncResolver *funcResolver);
94
+
95
+ static NodeApi *current() {
96
+ return current_;
97
+ }
98
+
99
+ static void setCurrent(NodeApi *current) {
100
+ current_ = current;
101
+ }
102
+
103
+ class Scope {
104
+ public:
105
+ Scope(NodeApi *nodeApi) : prevNodeApi_(NodeApi::current_) {
106
+ NodeApi::current_ = nodeApi;
107
+ }
108
+
109
+ ~Scope() {
110
+ NodeApi::current_ = prevNodeApi_;
111
+ }
112
+
113
+ private:
114
+ NodeApi *prevNodeApi_;
115
+ };
116
+
117
+ public:
118
+ #define NODE_API_FUNC(func) decltype(::func) *const func;
119
+ #include "NodeApi.inc"
120
+
121
+ private:
122
+ static thread_local NodeApi *current_;
123
+ };
124
+
125
+ } // namespace Microsoft::NodeApiJsi
126
+
127
+ #endif // !APILOADERS_NODEAPI_H_
@@ -0,0 +1,125 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #ifndef NODE_API_FUNC
5
+ #define NODE_API_FUNC(func)
6
+ #endif
7
+
8
+ // The Node-API functions sorted alphabetically.
9
+ NODE_API_FUNC(napi_add_finalizer)
10
+ NODE_API_FUNC(napi_adjust_external_memory)
11
+ NODE_API_FUNC(napi_call_function)
12
+ NODE_API_FUNC(napi_check_object_type_tag)
13
+ NODE_API_FUNC(napi_close_escapable_handle_scope)
14
+ NODE_API_FUNC(napi_close_handle_scope)
15
+ NODE_API_FUNC(napi_coerce_to_bool)
16
+ NODE_API_FUNC(napi_coerce_to_number)
17
+ NODE_API_FUNC(napi_coerce_to_object)
18
+ NODE_API_FUNC(napi_coerce_to_string)
19
+ NODE_API_FUNC(napi_create_array_with_length)
20
+ NODE_API_FUNC(napi_create_array)
21
+ NODE_API_FUNC(napi_create_arraybuffer)
22
+ NODE_API_FUNC(napi_create_bigint_int64)
23
+ NODE_API_FUNC(napi_create_bigint_uint64)
24
+ NODE_API_FUNC(napi_create_bigint_words)
25
+ NODE_API_FUNC(napi_create_dataview)
26
+ NODE_API_FUNC(napi_create_date)
27
+ NODE_API_FUNC(napi_create_double)
28
+ NODE_API_FUNC(napi_create_error)
29
+ NODE_API_FUNC(napi_create_external_arraybuffer)
30
+ NODE_API_FUNC(napi_create_external)
31
+ NODE_API_FUNC(napi_create_function)
32
+ NODE_API_FUNC(napi_create_int32)
33
+ NODE_API_FUNC(napi_create_int64)
34
+ NODE_API_FUNC(napi_create_object)
35
+ NODE_API_FUNC(napi_create_promise)
36
+ NODE_API_FUNC(napi_create_range_error)
37
+ NODE_API_FUNC(napi_create_reference)
38
+ NODE_API_FUNC(napi_create_string_latin1)
39
+ NODE_API_FUNC(napi_create_string_utf16)
40
+ NODE_API_FUNC(napi_create_string_utf8)
41
+ NODE_API_FUNC(napi_create_symbol)
42
+ NODE_API_FUNC(napi_create_type_error)
43
+ NODE_API_FUNC(napi_create_typedarray)
44
+ NODE_API_FUNC(napi_create_uint32)
45
+ NODE_API_FUNC(napi_define_class)
46
+ NODE_API_FUNC(napi_define_properties)
47
+ NODE_API_FUNC(napi_delete_element)
48
+ NODE_API_FUNC(napi_delete_property)
49
+ NODE_API_FUNC(napi_delete_reference)
50
+ NODE_API_FUNC(napi_detach_arraybuffer)
51
+ NODE_API_FUNC(napi_escape_handle)
52
+ NODE_API_FUNC(napi_get_all_property_names)
53
+ NODE_API_FUNC(napi_get_and_clear_last_exception)
54
+ NODE_API_FUNC(napi_get_array_length)
55
+ NODE_API_FUNC(napi_get_arraybuffer_info)
56
+ NODE_API_FUNC(napi_get_boolean)
57
+ NODE_API_FUNC(napi_get_cb_info)
58
+ NODE_API_FUNC(napi_get_dataview_info)
59
+ NODE_API_FUNC(napi_get_date_value)
60
+ NODE_API_FUNC(napi_get_element)
61
+ NODE_API_FUNC(napi_get_global)
62
+ NODE_API_FUNC(napi_get_instance_data)
63
+ NODE_API_FUNC(napi_get_last_error_info)
64
+ NODE_API_FUNC(napi_get_named_property)
65
+ NODE_API_FUNC(napi_get_new_target)
66
+ NODE_API_FUNC(napi_get_null)
67
+ NODE_API_FUNC(napi_get_property_names)
68
+ NODE_API_FUNC(napi_get_property)
69
+ NODE_API_FUNC(napi_get_prototype)
70
+ NODE_API_FUNC(napi_get_reference_value)
71
+ NODE_API_FUNC(napi_get_typedarray_info)
72
+ NODE_API_FUNC(napi_get_undefined)
73
+ NODE_API_FUNC(napi_get_value_bigint_int64)
74
+ NODE_API_FUNC(napi_get_value_bigint_uint64)
75
+ NODE_API_FUNC(napi_get_value_bigint_words)
76
+ NODE_API_FUNC(napi_get_value_bool)
77
+ NODE_API_FUNC(napi_get_value_double)
78
+ NODE_API_FUNC(napi_get_value_external)
79
+ NODE_API_FUNC(napi_get_value_int32)
80
+ NODE_API_FUNC(napi_get_value_int64)
81
+ NODE_API_FUNC(napi_get_value_string_latin1)
82
+ NODE_API_FUNC(napi_get_value_string_utf16)
83
+ NODE_API_FUNC(napi_get_value_string_utf8)
84
+ NODE_API_FUNC(napi_get_value_uint32)
85
+ NODE_API_FUNC(napi_get_version)
86
+ NODE_API_FUNC(napi_has_element)
87
+ NODE_API_FUNC(napi_has_named_property)
88
+ NODE_API_FUNC(napi_has_own_property)
89
+ NODE_API_FUNC(napi_has_property)
90
+ NODE_API_FUNC(napi_instanceof)
91
+ NODE_API_FUNC(napi_is_array)
92
+ NODE_API_FUNC(napi_is_arraybuffer)
93
+ NODE_API_FUNC(napi_is_dataview)
94
+ NODE_API_FUNC(napi_is_date)
95
+ NODE_API_FUNC(napi_is_detached_arraybuffer)
96
+ NODE_API_FUNC(napi_is_error)
97
+ NODE_API_FUNC(napi_is_exception_pending)
98
+ NODE_API_FUNC(napi_is_promise)
99
+ NODE_API_FUNC(napi_is_typedarray)
100
+ NODE_API_FUNC(napi_new_instance)
101
+ NODE_API_FUNC(napi_object_freeze)
102
+ NODE_API_FUNC(napi_object_seal)
103
+ NODE_API_FUNC(napi_open_escapable_handle_scope)
104
+ NODE_API_FUNC(napi_open_handle_scope)
105
+ NODE_API_FUNC(napi_reference_ref)
106
+ NODE_API_FUNC(napi_reference_unref)
107
+ NODE_API_FUNC(napi_reject_deferred)
108
+ NODE_API_FUNC(napi_remove_wrap)
109
+ NODE_API_FUNC(napi_resolve_deferred)
110
+ NODE_API_FUNC(napi_run_script)
111
+ NODE_API_FUNC(napi_set_element)
112
+ NODE_API_FUNC(napi_set_instance_data)
113
+ NODE_API_FUNC(napi_set_named_property)
114
+ NODE_API_FUNC(napi_set_property)
115
+ NODE_API_FUNC(napi_strict_equals)
116
+ NODE_API_FUNC(napi_throw_error)
117
+ NODE_API_FUNC(napi_throw_range_error)
118
+ NODE_API_FUNC(napi_throw_type_error)
119
+ NODE_API_FUNC(napi_throw)
120
+ NODE_API_FUNC(napi_type_tag_object)
121
+ NODE_API_FUNC(napi_typeof)
122
+ NODE_API_FUNC(napi_unwrap)
123
+ NODE_API_FUNC(napi_wrap)
124
+
125
+ #undef NODE_API_FUNC
@@ -0,0 +1,16 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "NodeApi.h"
5
+
6
+ namespace Microsoft::NodeApiJsi {
7
+
8
+ LibHandle LibLoader::loadLib(const char *libName) {
9
+ // TODO: implement
10
+ }
11
+
12
+ FuncPtr LibLoader::getFuncPtr(LibHandle libHandle, const char *funcName) {
13
+ // TODO: implement
14
+ }
15
+
16
+ } // namespace Microsoft::NodeApiJsi
@@ -0,0 +1,23 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "NodeApi.h"
5
+ #ifndef WIN32_LEAN_AND_MEAN
6
+ #define WIN32_LEAN_AND_MEAN
7
+ #endif
8
+ #ifndef NOMINMAX
9
+ #define NOMINMAX
10
+ #endif
11
+ #include <windows.h>
12
+
13
+ namespace Microsoft::NodeApiJsi {
14
+
15
+ LibHandle LibLoader::loadLib(const char *libName) {
16
+ return reinterpret_cast<LibHandle>(LoadLibraryA(libName));
17
+ }
18
+
19
+ FuncPtr LibLoader::getFuncPtr(LibHandle libHandle, const char *funcName) {
20
+ return reinterpret_cast<FuncPtr>(GetProcAddress(reinterpret_cast<HMODULE>(libHandle), funcName));
21
+ }
22
+
23
+ } // namespace Microsoft::NodeApiJsi