From ac3c3f66d2004ef9b915f168cca02d15e1d8c360 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 21 Nov 2024 17:17:19 +0100 Subject: [PATCH 01/66] Initial commit, add base for NodeJS and constructor for MetaCall, still a lot of work to do. --- source/metacall/include/metacall/metacall.h | 6 +- source/metacall/source/metacall.c | 23 +++ source/portability/CMakeLists.txt | 5 +- .../include/portability/portability.h | 1 + ...ler_detection.h => portability_compiler.h} | 6 +- .../portability/portability_constructor.h | 79 ++++++++++ source/ports/node_port/CMakeLists.txt | 43 +++++- source/ports/node_port/index.js | 142 +++++++++++++----- 8 files changed, 253 insertions(+), 52 deletions(-) rename source/portability/include/portability/{portability_compiler_detection.h => portability_compiler.h} (99%) create mode 100644 source/portability/include/portability/portability_constructor.h diff --git a/source/metacall/include/metacall/metacall.h b/source/metacall/include/metacall/metacall.h index a1cea928f..3e841fdcf 100644 --- a/source/metacall/include/metacall/metacall.h +++ b/source/metacall/include/metacall/metacall.h @@ -58,10 +58,8 @@ struct metacall_initialize_configuration_type; struct metacall_initialize_configuration_type { - char *tag; - void *options; // TODO: We should use a MetaCall value MAP here and merge it with the configuration. - // By this way loaders will be able to access this information in the backend and we - // can use a weak API in order to implement this successfully + const char *tag; /* Tag referring to the loader */ + void *options; /* Value of type Map that will be merged merged into the configuration of the loader */ }; typedef void *(*metacall_await_callback)(void *, void *); diff --git a/source/metacall/source/metacall.c b/source/metacall/source/metacall.c index 45ce6bf0f..45b949c70 100644 --- a/source/metacall/source/metacall.c +++ b/source/metacall/source/metacall.c @@ -35,6 +35,8 @@ #include +#include + #include #include @@ -68,6 +70,27 @@ static int metacall_plugin_extension_load(void); static void *metacallv_method(void *target, const char *name, method_invoke_ptr call, vector v, void *args[], size_t size); static type_id *metacall_type_ids(void *args[], size_t size); +/* -- Costructors -- */ + +portability_constructor(metacall_constructor) +{ + const char *metacall_host = environment_variable_get("METACALL_HOST", NULL); + + if (metacall_host != NULL) + { + struct metacall_initialize_configuration_type config[] = { + { metacall_host, NULL /* TODO: Initialize the map and define { host: true } */ }, + { NULL, NULL } + }; + + if (metacall_initialize_ex(config) != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall host constructor failed to initialize"); + exit(1); + } + } +} + /* -- Methods -- */ const char *metacall_serial(void) diff --git a/source/portability/CMakeLists.txt b/source/portability/CMakeLists.txt index 17d2b2159..2841f3aaa 100644 --- a/source/portability/CMakeLists.txt +++ b/source/portability/CMakeLists.txt @@ -35,16 +35,17 @@ set(source_path "${CMAKE_CURRENT_SOURCE_DIR}/source") set(headers ${include_path}/portability.h ${include_path}/portability_assert.h - ${include_path}/portability_path.h + ${include_path}/portability_constructor.h ${include_path}/portability_executable_path.h ${include_path}/portability_library_path.h + ${include_path}/portability_path.h ) set(sources ${source_path}/portability.c - ${source_path}/portability_path.c ${source_path}/portability_executable_path.c ${source_path}/portability_library_path.c + ${source_path}/portability_path.c ) # Group source files diff --git a/source/portability/include/portability/portability.h b/source/portability/include/portability/portability.h index 6316fda48..75af3411b 100644 --- a/source/portability/include/portability/portability.h +++ b/source/portability/include/portability/portability.h @@ -27,6 +27,7 @@ #include #include +#include #include #ifdef __cplusplus diff --git a/source/portability/include/portability/portability_compiler_detection.h b/source/portability/include/portability/portability_compiler.h similarity index 99% rename from source/portability/include/portability/portability_compiler_detection.h rename to source/portability/include/portability/portability_compiler.h index ec2e4eaaa..871adf181 100644 --- a/source/portability/include/portability/portability_compiler_detection.h +++ b/source/portability/include/portability/portability_compiler.h @@ -18,8 +18,8 @@ * */ -#ifndef PORTABILITY_COMPILER_DETECTION_H -#define PORTABILITY_COMPILER_DETECTION_H 1 +#ifndef PORTABILITY_COMPILER_H +#define PORTABILITY_COMPILER_H 1 /* TODO: This needs to be implemented properly, including another file for architecture and operative system detection */ @@ -490,4 +490,4 @@ // PORTABILITY_THREAD_LOCAL not defined for this configuration. #endif -#endif /* PORTABILITY_COMPILER_DETECTION_H */ +#endif /* PORTABILITY_COMPILER_H */ diff --git a/source/portability/include/portability/portability_constructor.h b/source/portability/include/portability/portability_constructor.h new file mode 100644 index 000000000..9dc72a838 --- /dev/null +++ b/source/portability/include/portability/portability_constructor.h @@ -0,0 +1,79 @@ +/* + * Portability Library by Parra Studios + * A generic cross-platform portability utility. + * + * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef PORTABILITY_CONSTRUCTOR_H +#define PORTABILITY_CONSTRUCTOR_H 1 + +/* -- Headers -- */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* -- Headers -- */ + +#include + +#include +#include + +/* -- Macros -- */ + +#ifndef portability_constructor + + #ifdef __cplusplus + #define portability_constructor(ctor) \ + static void ctor(void); \ + static struct PREPROCESSOR_CONCAT(ctor, _type) \ + { \ + PREPROCESSOR_CONCAT(ctor, _type) \ + (void) \ + { \ + ctor(); \ + } \ + } PREPROCESSOR_CONCAT(ctor, _ctor); \ + static void ctor(void) + #elif defined(_MSC_VER) + /* TODO: Test MSVC version in release mode */ + #pragma section(".CRT$XCU", read) + #define portability_constructor_impl(ctor, prefix) \ + static void ctor(void); \ + __declspec(allocate(".CRT$XCU")) void (*PREPROCESSOR_CONCAT(ctor, _ptr))(void) = ctor; \ + __pragma(comment(linker, "/include:" prefix PREPROCESSOR_STRINGIFY(ctor) "_ptr")) static void ctor(void) + #ifdef _WIN64 + #define portability_constructor(ctor) portability_constructor_impl(ctor, "") + #else + #define portability_constructor(ctor) portability_constructor_impl(ctor, "_") + #endif + #else + #define portability_constructor(ctor) \ + static void ctor(void) __attribute__((constructor)); \ + static void ctor(void) + #endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* PORTABILITY_CONSTRUCTOR_H */ diff --git a/source/ports/node_port/CMakeLists.txt b/source/ports/node_port/CMakeLists.txt index 2402d2a7f..9cbb94fbc 100644 --- a/source/ports/node_port/CMakeLists.txt +++ b/source/ports/node_port/CMakeLists.txt @@ -93,12 +93,6 @@ if(NOT OPTION_BUILD_CLI OR NOT OPTION_BUILD_LOADERS OR NOT OPTION_BUILD_LOADERS_ return() endif() -set(node_port_test "${target}_test") - -# -# Define test -# - if(OPTION_BUILD_THREAD_SANITIZER AND OPTION_BUILD_LOADERS_CS) # TODO: This test fails when run with thread sanitizer: # @@ -121,6 +115,14 @@ if(OPTION_BUILD_THREAD_SANITIZER AND OPTION_BUILD_LOADERS_CS) return() endif() +# +# Define test +# + +set(node_port_test "${target}_test") + +message(STATUS "Test ${node_port_test}") + add_test(NAME ${target} COMMAND ${CMAKE_COMMAND} -D "EXECUTABLE=$" -D "INPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/commands/node_port.txt" -P "${CMAKE_SOURCE_DIR}/source/cli/metacallcli/test/commands/command_runner.cmake" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} @@ -213,3 +215,32 @@ test_environment_variables(${target} ${TESTS_ENVIRONMENT_VARIABLES_RS} ${TESTS_ENVIRONMENT_VARIABLES_OPENSSL} ) + +# +# Test importing NodeJS Port from node.exe +# + +set(node_port_test_exec "${node_port_test}_executable") + +message(STATUS "Test ${node_port_test_exec}") + +add_test(NAME ${node_port_test_exec} + COMMAND ${NodeJS_EXECUTABLE} test/index.js + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +# Define test labels +set_property(TEST ${node_port_test_exec} + PROPERTY LABELS ${node_port_test_exec} +) + +# Environment variables +test_environment_variables(${node_port_test_exec} + "" + ${TESTS_ENVIRONMENT_VARIABLES} + ${TESTS_ENVIRONMENT_VARIABLES_COB} + ${TESTS_ENVIRONMENT_VARIABLES_C} + ${TESTS_ENVIRONMENT_VARIABLES_RS} + ${TESTS_ENVIRONMENT_VARIABLES_OPENSSL} + "METACALL_INSTALL_PATH=${PROJECT_OUTPUT_DIR}" +) diff --git a/source/ports/node_port/index.js b/source/ports/node_port/index.js index 10fcbf24e..0120fbf61 100644 --- a/source/ports/node_port/index.js +++ b/source/ports/node_port/index.js @@ -22,55 +22,123 @@ const mod = require('module'); const path = require('path'); +const fs = require('fs').promises; const { URL } = require('url'); /* TODO: RPC Loader */ -const addon = (() => { - try { - /* This forces metacall port to be run always by metacall cli */ - return process._linkedBinding('node_loader_port_module'); - } catch (e) { - console.error('MetaCall failed to load, probably you are importing this file from NodeJS directly.'); - console.error('You should use MetaCall CLI instead. Install it from: https://github.com/metacall/install'); - throw e; - - /* TODO: Until we find a better way to do this, we should disable it */ - /* - const write = (data, cb) => { - if (!process.stdout.write(data)) { - process.stdout.once('drain', cb); - } else { - process.nextTick(cb); +async function findFilesRecursively(dirPattern, filePattern, depthLimit = Infinity) { + const stack = [{ dir: dirPattern, depth: 0 }]; + const files = []; + const dirRegex = new RegExp(dirPattern); + const fileRegex = new RegExp(filePattern); + + while (stack.length > 0) { + const { dir, depth } = stack.pop(); + + try { + if (!dirRegex.test(dir)) { + continue; } - }; - // Notify synchronously that we are launching MetaCall - write('NodeJS detected, launching MetaCall...\n', () => { - try { - const { spawnSync } = require('child_process'); - const args = [...process.argv]; + if (depth > depthLimit) { + continue; + } - args.shift(); + const items = await fs.readdir(dir); - const result = spawnSync('metacall', args, {}); + for (const item of items) { + const fullPath = path.join(dir, item); + const stat = await fs.stat(fullPath); - if (result.error && result.error.code === 'ENOENT') { - write('MetaCall not found. Please install MetaCall from: https://github.com/metacall/install and run it again.\n', () => { - process.exit(1); - }); + if (stat.isDirectory()) { + stack.push({ dir: fullPath, depth: depth + 1 }); + } else if (stat.isFile() && fileRegex.test(item)) { + files.push(fullPath); } + } + } catch (err) { + console.error(`Error reading directory ${dir}:`, err); + } + } - process.exit(result.status !== null ? result.status : 1); - } catch (e) { - const message = 'MetaCall failed to load, probably you are importing this file from NodeJS directly.\n' - + e.message + '\n' - + 'Install MetaCall from: https://github.com/metacall/install and run it again.\n'; + return files; +} - write(message, () => { - throw e; - }); +const platformInstallPaths = () => { + switch (process.platform) { + case 'win32': + return { + paths: [ path.join(process.env['LOCALAPPDATA'], 'MetaCall', 'metacall') ], + name: 'metacall.dll' } - }); + case 'darwin': + return { + paths: [ '/opt/homebrew/lib/', '/usr/local/lib/' ], + name: 'libmetacall.dylib' + } + case 'linux': + return { + paths: [ '/usr/local/lib/', '/gnu/lib/' ], + name: 'libmetacall.so' + } + } + + throw new Error(`Platform ${process.platform} not supported`) +} + +const searchPaths = () => { + const customPath = process.env['METACALL_INSTALL_PATH']; + + if (customPath) { + return { + paths: [ customPath ], + name: /^(lib)?metacall(d)?\.(so|dylib|dll)$/ + } + } + + return platformInstallPaths() +} + +const findLibrary = async () => { + const searchData = searchPaths(); + + for (const p of searchData.paths) { + const files = await findFilesRecursively(p, searchData.name, 0); + + if (files.length !== 0) { + return files[0]; + } + } + + throw new Error('MetaCall library not found, if you have it in a special folder, define it through METACALL_INSTALL_PATH') +} + +const addon = (() => { + try { + /* If the binding can be loaded, it means MetaCall is being + * imported from the node_loader, in that case the runtime + * was initialized by node_loader itself and we can proceed. + */ + return process._linkedBinding('node_loader_port_module'); + } catch (e) { + /* If the port cannot be found, it means MetaCall port has + * been imported for the first time from node.exe, the + * runtime in this case has been initialized by node.exe, + * and MetaCall is not initialized */ + process.env['METACALL_HOST'] = 'node'; + + findLibrary().then(library => { + const { constants } = require('os'); + const m = { exports: {} }; + + process.dlopen(m, library, constants.dlopen.RTLD_GLOBAL | constants.dlopen.RTLD_NOW); + + // TODO: What to do with m? should we use process._linkedBinding instead, no? + + }).catch(err => { + console.log(err); + process.exit(1); + }); } })(); From 3ed5d236280fd983782615866234231958d3f229 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 21 Nov 2024 23:32:02 +0100 Subject: [PATCH 02/66] Implemented cwd and options map. --- source/loader/source/loader_impl.c | 7 +- source/loader/source/loader_manager_impl.c | 12 ++- source/metacall/source/metacall.c | 19 ++++- source/portability/CMakeLists.txt | 2 + .../portability/portability_working_path.h | 54 ++++++++++++++ .../source/portability_working_path.c | 74 +++++++++++++++++++ 6 files changed, 159 insertions(+), 9 deletions(-) create mode 100644 source/portability/include/portability/portability_working_path.h create mode 100644 source/portability/source/portability_working_path.c diff --git a/source/loader/source/loader_impl.c b/source/loader/source/loader_impl.c index c6ccf3297..6b7bbafe3 100644 --- a/source/loader/source/loader_impl.c +++ b/source/loader/source/loader_impl.c @@ -87,7 +87,7 @@ struct loader_impl_type loader_impl_data data; /* Derived metadata provided by the loader, usually contains the data of the VM, Interpreter or JIT */ context ctx; /* Contains the objects, classes and functions loaded in the global scope of each loader */ set type_info_map; /* Stores a set indexed by type name of all of the types existing in the loader (global scope (TODO: may need refactor per handle)) */ - void *options; /* Additional initialization options passed in the initialize phase */ + value options; /* Additional initialization options passed in the initialize phase */ set exec_path_map; /* Set of execution paths passed by the end user */ }; @@ -1539,6 +1539,11 @@ void loader_impl_destroy_deallocate(loader_impl impl) context_destroy(impl->ctx); + if (impl->options != NULL) + { + value_type_destroy(impl->options); + } + free(impl); } diff --git a/source/loader/source/loader_manager_impl.c b/source/loader/source/loader_manager_impl.c index b22fa1527..f3f4375a6 100644 --- a/source/loader/source/loader_manager_impl.c +++ b/source/loader/source/loader_manager_impl.c @@ -26,8 +26,8 @@ #include -#include #include +#include #include @@ -52,8 +52,8 @@ static void *loader_manager_impl_is_destroyed_ptr = NULL; vector loader_manager_impl_script_paths_initialize(void) { - portability_executable_path_str exe_path_str = { 0 }; - portability_executable_path_length exe_path_str_length = 0; + portability_working_path_str cwd_path_str = { 0 }; + portability_working_path_length cwd_path_str_length = 0; char *script_path = NULL; size_t script_path_size = 0; vector script_paths = vector_create_type(char *); @@ -63,11 +63,9 @@ vector loader_manager_impl_script_paths_initialize(void) return NULL; } - if (portability_executable_path(exe_path_str, &exe_path_str_length) == 0) + if (portability_working_path(cwd_path_str, &cwd_path_str_length) == 0) { - size_t exe_directory_size = portability_path_get_directory_inplace(exe_path_str, exe_path_str_length + 1); - - script_path = environment_variable_path_create(LOADER_SCRIPT_PATH, exe_path_str, exe_directory_size, &script_path_size); + script_path = environment_variable_path_create(LOADER_SCRIPT_PATH, cwd_path_str, cwd_path_str_length + 1, &script_path_size); } else { diff --git a/source/metacall/source/metacall.c b/source/metacall/source/metacall.c index 45b949c70..171c18482 100644 --- a/source/metacall/source/metacall.c +++ b/source/metacall/source/metacall.c @@ -76,16 +76,33 @@ portability_constructor(metacall_constructor) { const char *metacall_host = environment_variable_get("METACALL_HOST", NULL); + /* We are running from a different host, initialize the loader of the host + * and redirect it to the existing symbols, also avoiding initialization + * and destruction of the runtime as it is being managed externally to MetaCall */ if (metacall_host != NULL) { + static const char host_str[] = "host"; + struct metacall_initialize_configuration_type config[] = { - { metacall_host, NULL /* TODO: Initialize the map and define { host: true } */ }, + { metacall_host, metacall_value_create_map(NULL, 1) }, { NULL, NULL } }; + /* Initialize the loader options with a map defining its options to { "host": true } */ + void **host_tuple, **options_map = metacall_value_to_map(config[0].options); + + options_map[0] = metacall_value_create_array(NULL, 2); + + host_tuple = metacall_value_to_array(options_map[0]); + + host_tuple[0] = metacall_value_create_string(host_str, sizeof(host_str) - 1); + host_tuple[1] = metacall_value_create_bool(1); + + /* Initialize MetaCall with extra options, defining the host properly */ if (metacall_initialize_ex(config) != 0) { log_write("metacall", LOG_LEVEL_ERROR, "MetaCall host constructor failed to initialize"); + metacall_value_destroy(config[0].options); exit(1); } } diff --git a/source/portability/CMakeLists.txt b/source/portability/CMakeLists.txt index 2841f3aaa..cf4af64c6 100644 --- a/source/portability/CMakeLists.txt +++ b/source/portability/CMakeLists.txt @@ -38,6 +38,7 @@ set(headers ${include_path}/portability_constructor.h ${include_path}/portability_executable_path.h ${include_path}/portability_library_path.h + ${include_path}/portability_working_path.h ${include_path}/portability_path.h ) @@ -45,6 +46,7 @@ set(sources ${source_path}/portability.c ${source_path}/portability_executable_path.c ${source_path}/portability_library_path.c + ${source_path}/portability_working_path.c ${source_path}/portability_path.c ) diff --git a/source/portability/include/portability/portability_working_path.h b/source/portability/include/portability/portability_working_path.h new file mode 100644 index 000000000..00866a3a9 --- /dev/null +++ b/source/portability/include/portability/portability_working_path.h @@ -0,0 +1,54 @@ +/* + * Portability Library by Parra Studios + * A generic cross-platform portability utility. + * + * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef PORTABILITY_WORKING_PATH_H +#define PORTABILITY_WORKING_PATH_H 1 + +/* -- Headers -- */ + +#include + +#include + +/* -- Type Definitions -- */ + +typedef char portability_working_path_str[PORTABILITY_PATH_SIZE]; + +#if defined(WIN32) || defined(_WIN32) || \ + defined(__CYGWIN__) || defined(__CYGWIN32__) || \ + defined(__MINGW32__) || defined(__MINGW64__) +typedef DWORD portability_working_path_length; +#else +typedef size_t portability_working_path_length; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* -- Methods -- */ + +PORTABILITY_API int portability_working_path(portability_working_path_str path, portability_working_path_length *length); + +#ifdef __cplusplus +} +#endif + +#endif /* PORTABILITY_WORKING_PATH_H */ diff --git a/source/portability/source/portability_working_path.c b/source/portability/source/portability_working_path.c new file mode 100644 index 000000000..1511cef35 --- /dev/null +++ b/source/portability/source/portability_working_path.c @@ -0,0 +1,74 @@ +/* + * Portability Library by Parra Studios + * A generic cross-platform portability utility. + * + * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include + +#if defined(WIN32) || defined(_WIN32) || \ + defined(__CYGWIN__) || defined(__CYGWIN32__) || \ + defined(__MINGW32__) || defined(__MINGW64__) + #include +#else + #include +#endif + +int portability_working_path(portability_working_path_str path, portability_working_path_length *length) +{ + const portability_working_path_length path_max_length = PORTABILITY_PATH_SIZE; + + /* Reset the path */ + memset(path, 0, path_max_length); + +#if defined(WIN32) || defined(_WIN32) || \ + defined(__CYGWIN__) || defined(__CYGWIN32__) || \ + defined(__MINGW32__) || defined(__MINGW64__) + *length = GetCurrentDirectory(0, NULL); + + if (*length == 0) + { + /* TODO: DWORD dw = GetLastError(); */ + return 1; + } + + if (*length > path_max_length) + { + /* TODO: Handle error */ + return 1; + } + + if (GetCurrentDirectory(*length, path) == 0) + { + /* TODO: DWORD dw = GetLastError(); */ + return 1; + } +#else + if (getcwd(path, path_max_length) == NULL) + { + *length = 0; + /* TODO: Handle error */ + return 1; + } + + *length = strnlen(path, path_max_length); +#endif + + return 0; +} From 8e8fe8b46545a286f452cb0062db7db1aaeb3502 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 22 Nov 2024 13:25:37 +0100 Subject: [PATCH 03/66] Add functions for detecting host from loader side. --- source/loader/include/loader/loader.h | 10 +-- source/loader/include/loader/loader_impl.h | 6 +- source/loader/source/loader.c | 16 ++++- source/loader/source/loader_impl.c | 37 ++++++++++- source/loaders/node_loader/CMakeLists.txt | 4 +- .../node_loader/source/node_loader_impl.cpp | 39 ++++++------ .../node_loader/source/node_loader_port.cpp | 11 ---- source/metacall/source/metacall.c | 63 ++++++++++--------- 8 files changed, 118 insertions(+), 68 deletions(-) diff --git a/source/loader/include/loader/loader.h b/source/loader/include/loader/loader.h index b7fec73ec..3c31ba98d 100644 --- a/source/loader/include/loader/loader.h +++ b/source/loader/include/loader/loader.h @@ -33,10 +33,6 @@ extern "C" { #endif -/* -- Headers -- */ - -#include - /* -- Forward Declarations -- */ struct loader_type; @@ -81,7 +77,11 @@ LOADER_API void *loader_get_handle(const loader_tag tag, const char *name); LOADER_API void loader_set_options(const loader_tag tag, void *options); -LOADER_API void *loader_get_options(const loader_tag tag); +LOADER_API value loader_get_options(const loader_tag tag); + +LOADER_API value loader_get_option(const loader_tag tag, const char *field); + +LOADER_API int loader_get_option_host(const loader_tag tag); LOADER_API int loader_handle_initialize(loader_impl impl, const loader_path name, void **handle_ptr); diff --git a/source/loader/include/loader/loader_impl.h b/source/loader/include/loader/loader_impl.h index c6c8826d6..8eea205e2 100644 --- a/source/loader/include/loader/loader_impl.h +++ b/source/loader/include/loader/loader_impl.h @@ -67,7 +67,11 @@ LOADER_API void *loader_impl_get_handle(loader_impl impl, const char *name); LOADER_API void loader_impl_set_options(loader_impl impl, void *options); -LOADER_API void *loader_impl_get_options(loader_impl impl); +LOADER_API value loader_impl_get_options(loader_impl impl); + +LOADER_API value loader_impl_get_option(loader_impl impl, const char *field); + +LOADER_API int loader_impl_get_option_host(loader_impl impl); LOADER_API int loader_impl_handle_initialize(plugin_manager manager, plugin p, loader_impl impl, const loader_path name, void **handle_ptr); diff --git a/source/loader/source/loader.c b/source/loader/source/loader.c index 82bb7d5a4..13b136445 100644 --- a/source/loader/source/loader.c +++ b/source/loader/source/loader.c @@ -547,13 +547,27 @@ void loader_set_options(const loader_tag tag, void *options) loader_impl_set_options(plugin_impl_type(p, loader_impl), options); } -void *loader_get_options(const loader_tag tag) +value loader_get_options(const loader_tag tag) { plugin p = loader_get_impl_plugin(tag); return loader_impl_get_options(plugin_impl_type(p, loader_impl)); } +value loader_get_option(const loader_tag tag, const char *field) +{ + plugin p = loader_get_impl_plugin(tag); + + return loader_impl_get_option(plugin_impl_type(p, loader_impl), field); +} + +int loader_get_option_host(const loader_tag tag) +{ + plugin p = loader_get_impl_plugin(tag); + + return loader_impl_get_option_host(plugin_impl_type(p, loader_impl)); +} + int loader_handle_initialize(loader_impl impl, const loader_path name, void **handle_ptr) { if (loader_initialize() == 1) diff --git a/source/loader/source/loader_impl.c b/source/loader/source/loader_impl.c index 6b7bbafe3..80c58db32 100644 --- a/source/loader/source/loader_impl.c +++ b/source/loader/source/loader_impl.c @@ -1158,7 +1158,7 @@ void loader_impl_set_options(loader_impl impl, void *options) } } -void *loader_impl_get_options(loader_impl impl) +value loader_impl_get_options(loader_impl impl) { if (impl != NULL) { @@ -1168,6 +1168,41 @@ void *loader_impl_get_options(loader_impl impl) return NULL; } +value loader_impl_get_option(loader_impl impl, const char *field) +{ + value *options_map = value_to_map(impl->options); + size_t i, size = value_type_count(impl->options); + + for (i = 0; i < size; ++i) + { + value *options_tuple = value_to_array(options_map[i]); + + if (value_type_id(options_tuple[0]) == TYPE_STRING) + { + const char *str = value_to_string(options_tuple[0]); + + if (strncmp(str, field, value_type_size(options_tuple[0])) == 0) + { + return options_tuple[1]; + } + } + } + + return NULL; +} + +int loader_impl_get_option_host(loader_impl impl) +{ + value host = loader_impl_get_option(impl, "host"); + + if (host != NULL && value_type_id(host) == TYPE_BOOL) + { + return value_to_bool(host); + } + + return 0; +} + int loader_impl_handle_initialize(plugin_manager manager, plugin p, loader_impl impl, const loader_path name, void **handle_ptr) { if (impl != NULL) diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index 814f411f7..70108f53e 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -156,7 +156,9 @@ target_include_directories(${target} target_link_libraries(${target} PRIVATE ${META_PROJECT_NAME}::metacall # MetaCall library - ${NodeJS_LIBRARY} # NodeJS library + + # TODO: Implement delayed load + # ${NodeJS_LIBRARY} # NodeJS library PUBLIC ${DEFAULT_LIBRARIES} diff --git a/source/loaders/node_loader/source/node_loader_impl.cpp b/source/loaders/node_loader/source/node_loader_impl.cpp index bfe6e90c4..af983d29d 100644 --- a/source/loaders/node_loader/source/node_loader_impl.cpp +++ b/source/loaders/node_loader/source/node_loader_impl.cpp @@ -3937,34 +3937,37 @@ loader_impl_data node_loader_impl_initialize(loader_impl impl, configuration con config }; - /* Create NodeJS thread */ - if (uv_thread_create(&node_impl->thread, node_loader_impl_thread, &thread_data) != 0) + if (loader_impl_get_option_host(impl) == 0) { - log_write("metacall", LOG_LEVEL_ERROR, "Invalid NodeJS Thread creation"); + /* Create NodeJS thread */ + if (uv_thread_create(&node_impl->thread, node_loader_impl_thread, &thread_data) != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "Invalid NodeJS Thread creation"); - /* TODO: Clear resources */ + /* TODO: Clear resources */ - delete node_impl; + delete node_impl; - return NULL; - } + return NULL; + } - /* Wait until start has been launch */ - uv_mutex_lock(&node_impl->mutex); + /* Wait until start has been launch */ + uv_mutex_lock(&node_impl->mutex); - uv_cond_wait(&node_impl->cond, &node_impl->mutex); + uv_cond_wait(&node_impl->cond, &node_impl->mutex); - if (node_impl->error_message != NULL) - { - uv_mutex_unlock(&node_impl->mutex); + if (node_impl->error_message != NULL) + { + uv_mutex_unlock(&node_impl->mutex); - /* TODO: Remove this when implementing thread safe */ - log_write("metacall", LOG_LEVEL_ERROR, node_impl->error_message); + /* TODO: Remove this when implementing thread safe */ + log_write("metacall", LOG_LEVEL_ERROR, node_impl->error_message); - return NULL; - } + return NULL; + } - uv_mutex_unlock(&node_impl->mutex); + uv_mutex_unlock(&node_impl->mutex); + } /* Call initialize function with thread safe */ { diff --git a/source/loaders/node_loader/source/node_loader_port.cpp b/source/loaders/node_loader/source/node_loader_port.cpp index ed681f1e9..8261f6bce 100644 --- a/source/loaders/node_loader/source/node_loader_port.cpp +++ b/source/loaders/node_loader/source/node_loader_port.cpp @@ -836,17 +836,6 @@ void node_loader_port_exports(napi_env env, napi_value exports) /* This function is called by NodeJs when the module is required */ napi_value node_loader_port_initialize(napi_env env, napi_value exports) { -/* Note: This should not be necessary because we do not allow to use ports outside MetaCall */ -#if 0 - if (metacall_initialize() != 0) - { - /* TODO: Show error message (when error handling is properly implemented in the core lib) */ - napi_throw_error(env, nullptr, "MetaCall failed to initialize"); - - return nullptr; - } -#endif - node_loader_port_exports(env, exports); return exports; diff --git a/source/metacall/source/metacall.c b/source/metacall/source/metacall.c index 171c18482..8a9ad2eb9 100644 --- a/source/metacall/source/metacall.c +++ b/source/metacall/source/metacall.c @@ -74,36 +74,39 @@ static type_id *metacall_type_ids(void *args[], size_t size); portability_constructor(metacall_constructor) { - const char *metacall_host = environment_variable_get("METACALL_HOST", NULL); - - /* We are running from a different host, initialize the loader of the host - * and redirect it to the existing symbols, also avoiding initialization - * and destruction of the runtime as it is being managed externally to MetaCall */ - if (metacall_host != NULL) + if (metacall_initialize_flag == 1) { - static const char host_str[] = "host"; + const char *metacall_host = environment_variable_get("METACALL_HOST", NULL); - struct metacall_initialize_configuration_type config[] = { - { metacall_host, metacall_value_create_map(NULL, 1) }, - { NULL, NULL } - }; + /* We are running from a different host, initialize the loader of the host + * and redirect it to the existing symbols, also avoiding initialization + * and destruction of the runtime as it is being managed externally to MetaCall */ + if (metacall_host != NULL) + { + static const char host_str[] = "host"; - /* Initialize the loader options with a map defining its options to { "host": true } */ - void **host_tuple, **options_map = metacall_value_to_map(config[0].options); + struct metacall_initialize_configuration_type config[] = { + { metacall_host, metacall_value_create_map(NULL, 1) }, + { NULL, NULL } + }; - options_map[0] = metacall_value_create_array(NULL, 2); + /* Initialize the loader options with a map defining its options to { "host": true } */ + void **host_tuple, **options_map = metacall_value_to_map(config[0].options); - host_tuple = metacall_value_to_array(options_map[0]); + options_map[0] = metacall_value_create_array(NULL, 2); - host_tuple[0] = metacall_value_create_string(host_str, sizeof(host_str) - 1); - host_tuple[1] = metacall_value_create_bool(1); + host_tuple = metacall_value_to_array(options_map[0]); - /* Initialize MetaCall with extra options, defining the host properly */ - if (metacall_initialize_ex(config) != 0) - { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall host constructor failed to initialize"); - metacall_value_destroy(config[0].options); - exit(1); + host_tuple[0] = metacall_value_create_string(host_str, sizeof(host_str) - 1); + host_tuple[1] = metacall_value_create_bool(1); + + /* Initialize MetaCall with extra options, defining the host properly */ + if (metacall_initialize_ex(config) != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall host constructor failed to initialize"); + metacall_value_destroy(config[0].options); + exit(1); + } } } } @@ -179,6 +182,13 @@ int metacall_initialize(void) { memory_allocator allocator; + if (metacall_initialize_flag == 0) + { + log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall already initialized"); + + return 0; + } + /* Initialize logs by default to stdout if none has been defined */ if (metacall_log_null_flag != 0 && log_size() == 0) { @@ -194,13 +204,6 @@ int metacall_initialize(void) log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall default logger to stdout initialized"); } - if (metacall_initialize_flag == 0) - { - log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall already initialized"); - - return 0; - } - log_write("metacall", LOG_LEVEL_DEBUG, "Initializing MetaCall"); /* Initialize MetaCall version environment variable */ From 355c12f1f274ad381d7bdc67186852ada4a73039 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 27 Nov 2024 23:01:13 +0100 Subject: [PATCH 04/66] Improve dynlink, trying to hook dlsym. --- .../include/cli_core_plugin/cli_core_plugin.h | 4 -- .../cli_sandbox_plugin/cli_sandbox_plugin.h | 4 -- .../include/funchook_detour/funchook_detour.h | 6 -- source/dynlink/CMakeLists.txt | 3 - source/dynlink/include/dynlink/dynlink.h | 1 - source/dynlink/include/dynlink/dynlink_impl.h | 4 -- .../include/dynlink/dynlink_impl_beos.h | 2 - .../include/dynlink/dynlink_impl_macos.h | 2 - .../dynlink/dynlink_impl_symbol_beos.h | 62 ------------------ .../dynlink/dynlink_impl_symbol_macos.h | 62 ------------------ .../dynlink/dynlink_impl_symbol_unix.h | 62 ------------------ .../dynlink/dynlink_impl_symbol_win32.h | 58 ----------------- .../include/dynlink/dynlink_impl_unix.h | 2 - .../include/dynlink/dynlink_impl_win32.h | 2 - .../include/dynlink/dynlink_interface.h | 21 ------- .../dynlink/include/dynlink/dynlink_symbol.h | 63 ------------------- source/dynlink/include/dynlink/dynlink_type.h | 17 +++++ source/dynlink/source/dynlink_impl_beos.c | 2 +- source/dynlink/source/dynlink_impl_macos.c | 3 +- source/dynlink/source/dynlink_impl_unix.c | 2 +- source/dynlink/source/dynlink_impl_win32.c | 2 +- source/dynlink/source/dynlink_symbol.c | 51 --------------- .../plugin_extension/plugin_extension.h | 4 -- .../c_loader/include/c_loader/c_loader.h | 6 -- .../include/cob_loader/cob_loader.h | 6 -- .../cr_loader/include/cr_loader/cr_loader.h | 6 -- .../cs_loader/include/cs_loader/cs_loader.h | 6 -- .../include/dart_loader/dart_loader.h | 6 -- .../include/ext_loader/ext_loader.h | 6 -- .../ext_loader/source/ext_loader_impl.cpp | 4 +- .../include/file_loader/file_loader.h | 6 -- .../include/java_loader/java_loader.h | 6 -- .../jl_loader/include/jl_loader/jl_loader.h | 6 -- .../js_loader/include/js_loader/js_loader.h | 6 -- .../include/jsm_loader/jsm_loader.h | 6 -- .../include/llvm_loader/llvm_loader.h | 6 -- .../include/lua_loader/lua_loader.h | 6 -- .../include/mock_loader/mock_loader.h | 6 -- source/loaders/node_loader/CMakeLists.txt | 2 +- .../include/node_loader/node_loader.h | 6 -- .../node_loader/source/node_loader_impl.cpp | 52 ++++++++------- .../py_loader/include/py_loader/py_loader.h | 6 -- .../rb_loader/include/rb_loader/rb_loader.h | 6 -- .../include/rpc_loader/rpc_loader.h | 6 -- .../rs_loader/include/rs_loader/rs_loader.h | 6 -- .../ts_loader/include/ts_loader/ts_loader.h | 6 -- .../include/wasm_loader/wasm_loader.h | 6 -- source/metacall/source/metacall.c | 59 +++++++++++++++++ source/plugin/source/plugin_descriptor.c | 2 +- source/plugin/source/plugin_loader.c | 9 ++- .../backtrace_plugin/backtrace_plugin.h | 4 -- .../include/sandbox_plugin/sandbox_plugin.h | 4 -- .../sum/include/sum_extension/sum_extension.h | 4 -- .../include/metacall_serial/metacall_serial.h | 6 -- .../rapid_json_serial/rapid_json_serial.h | 6 -- .../dynlink_test/source/dynlink_test.cpp | 6 +- 56 files changed, 120 insertions(+), 603 deletions(-) delete mode 100644 source/dynlink/include/dynlink/dynlink_impl_symbol_beos.h delete mode 100644 source/dynlink/include/dynlink/dynlink_impl_symbol_macos.h delete mode 100644 source/dynlink/include/dynlink/dynlink_impl_symbol_unix.h delete mode 100644 source/dynlink/include/dynlink/dynlink_impl_symbol_win32.h delete mode 100644 source/dynlink/include/dynlink/dynlink_symbol.h delete mode 100644 source/dynlink/source/dynlink_symbol.c diff --git a/source/cli/plugins/cli_core_plugin/include/cli_core_plugin/cli_core_plugin.h b/source/cli/plugins/cli_core_plugin/include/cli_core_plugin/cli_core_plugin.h index e27865d26..6c4446d9e 100644 --- a/source/cli/plugins/cli_core_plugin/include/cli_core_plugin/cli_core_plugin.h +++ b/source/cli/plugins/cli_core_plugin/include/cli_core_plugin/cli_core_plugin.h @@ -23,16 +23,12 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif CLI_CORE_PLUGIN_API int cli_core_plugin(void *loader, void *handle); -DYNLINK_SYMBOL_EXPORT(cli_core_plugin); - #ifdef __cplusplus } #endif diff --git a/source/cli/plugins/cli_sandbox_plugin/include/cli_sandbox_plugin/cli_sandbox_plugin.h b/source/cli/plugins/cli_sandbox_plugin/include/cli_sandbox_plugin/cli_sandbox_plugin.h index f0f1aa671..a11ef6abc 100644 --- a/source/cli/plugins/cli_sandbox_plugin/include/cli_sandbox_plugin/cli_sandbox_plugin.h +++ b/source/cli/plugins/cli_sandbox_plugin/include/cli_sandbox_plugin/cli_sandbox_plugin.h @@ -23,16 +23,12 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif CLI_SANDBOX_PLUGIN_API int cli_sandbox_plugin(void *loader, void *handle); -DYNLINK_SYMBOL_EXPORT(cli_sandbox_plugin); - #ifdef __cplusplus } #endif diff --git a/source/detours/funchook_detour/include/funchook_detour/funchook_detour.h b/source/detours/funchook_detour/include/funchook_detour/funchook_detour.h index b1967f77d..551ace90b 100644 --- a/source/detours/funchook_detour/include/funchook_detour/funchook_detour.h +++ b/source/detours/funchook_detour/include/funchook_detour/funchook_detour.h @@ -27,8 +27,6 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif @@ -45,8 +43,6 @@ extern "C" { */ FUNCHOOK_DETOUR_API detour_interface funchook_detour_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(funchook_detour_impl_interface_singleton); - /** * @brief * Provide the module information @@ -57,8 +53,6 @@ DYNLINK_SYMBOL_EXPORT(funchook_detour_impl_interface_singleton); */ FUNCHOOK_DETOUR_API const char *funchook_detour_print_info(void); -DYNLINK_SYMBOL_EXPORT(funchook_detour_print_info); - #ifdef __cplusplus } #endif diff --git a/source/dynlink/CMakeLists.txt b/source/dynlink/CMakeLists.txt index 0c1bd9294..dbb770bec 100644 --- a/source/dynlink/CMakeLists.txt +++ b/source/dynlink/CMakeLists.txt @@ -47,9 +47,7 @@ set(headers ${include_path}/dynlink.h ${include_path}/dynlink_flags.h ${include_path}/dynlink_impl.h - ${include_path}/dynlink_impl_symbol_${DYNLINK_IMPL_INTERFACE_NAME}.h ${include_path}/dynlink_impl_${DYNLINK_IMPL_INTERFACE_NAME}.h - ${include_path}/dynlink_symbol.h ) set(sources @@ -57,7 +55,6 @@ set(sources ${source_path}/dynlink_impl.c ${source_path}/dynlink_impl_${DYNLINK_IMPL_INTERFACE_NAME}.c ${source_path}/dynlink_interface.c - ${source_path}/dynlink_symbol.c ) # Group source files diff --git a/source/dynlink/include/dynlink/dynlink.h b/source/dynlink/include/dynlink/dynlink.h index 2b42705a6..77102c9e1 100644 --- a/source/dynlink/include/dynlink/dynlink.h +++ b/source/dynlink/include/dynlink/dynlink.h @@ -29,7 +29,6 @@ #include #include -#include #ifdef __cplusplus extern "C" { diff --git a/source/dynlink/include/dynlink/dynlink_impl.h b/source/dynlink/include/dynlink/dynlink_impl.h index 3185db4aa..8f09c5195 100644 --- a/source/dynlink/include/dynlink/dynlink_impl.h +++ b/source/dynlink/include/dynlink/dynlink_impl.h @@ -33,10 +33,6 @@ extern "C" { #endif -/* -- Headers -- */ - -#include - /* -- Methods -- */ /** diff --git a/source/dynlink/include/dynlink/dynlink_impl_beos.h b/source/dynlink/include/dynlink/dynlink_impl_beos.h index f77adbb3e..60efcdc2a 100644 --- a/source/dynlink/include/dynlink/dynlink_impl_beos.h +++ b/source/dynlink/include/dynlink/dynlink_impl_beos.h @@ -25,8 +25,6 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/source/dynlink/include/dynlink/dynlink_impl_macos.h b/source/dynlink/include/dynlink/dynlink_impl_macos.h index d2bce45dd..404235e30 100644 --- a/source/dynlink/include/dynlink/dynlink_impl_macos.h +++ b/source/dynlink/include/dynlink/dynlink_impl_macos.h @@ -25,8 +25,6 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/source/dynlink/include/dynlink/dynlink_impl_symbol_beos.h b/source/dynlink/include/dynlink/dynlink_impl_symbol_beos.h deleted file mode 100644 index 6530fd895..000000000 --- a/source/dynlink/include/dynlink/dynlink_impl_symbol_beos.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Dynamic Link Library by Parra Studios - * A library for dynamic loading and linking shared objects at run-time. - * - * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef DYNLINK_IMPL_SYMBOL_BEOS_H -#define DYNLINK_IMPL_SYMBOL_BEOS_H 1 - -/* -- Headers -- */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* -- Definitions -- */ - -#define DYNLINK_SYMBOL_PREFIX \ - dynlink_symbol_ - -/* -- Macros -- */ - -#define DYNLINK_SYMBOL_EXPORT(name) \ - DYNLINK_API struct dynlink_symbol_addr_beos_type DYNLINK_SYMBOL_NAME(name) = { \ - (dynlink_symbol_addr_beos_impl)&name \ - } - -#define DYNLINK_SYMBOL_GET(name) \ - ((dynlink_symbol_addr_beos)(name))->symbol - -/* -- Type definitions -- */ - -typedef void (*dynlink_symbol_addr_beos_impl)(void); - -typedef struct dynlink_symbol_addr_beos_type -{ - dynlink_symbol_addr_beos_impl symbol; -} * dynlink_symbol_addr_beos; - -typedef dynlink_symbol_addr_beos dynlink_symbol_addr; - -#ifdef __cplusplus -} -#endif - -#endif /* DYNLINK_IMPL_SYMBOL_BEOS_H */ diff --git a/source/dynlink/include/dynlink/dynlink_impl_symbol_macos.h b/source/dynlink/include/dynlink/dynlink_impl_symbol_macos.h deleted file mode 100644 index 7d92286e6..000000000 --- a/source/dynlink/include/dynlink/dynlink_impl_symbol_macos.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Dynamic Link Library by Parra Studios - * A library for dynamic loading and linking shared objects at run-time. - * - * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef DYNLINK_IMPL_SYMBOL_MACOS_H -#define DYNLINK_IMPL_SYMBOL_MACOS_H 1 - -/* -- Headers -- */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* -- Definitions -- */ - -#define DYNLINK_SYMBOL_PREFIX \ - dynlink_symbol_ - -/* -- Macros -- */ - -#define DYNLINK_SYMBOL_EXPORT(name) \ - DYNLINK_API struct dynlink_symbol_addr_macos_type DYNLINK_SYMBOL_NAME(name) = { \ - (dynlink_symbol_addr_macos_impl)&name \ - } - -#define DYNLINK_SYMBOL_GET(name) \ - ((dynlink_symbol_addr_macos)(name))->symbol - -/* -- Type definitions -- */ - -typedef void (*dynlink_symbol_addr_macos_impl)(void); - -typedef struct dynlink_symbol_addr_macos_type -{ - dynlink_symbol_addr_macos_impl symbol; -} * dynlink_symbol_addr_macos; - -typedef dynlink_symbol_addr_macos dynlink_symbol_addr; - -#ifdef __cplusplus -} -#endif - -#endif /* DYNLINK_IMPL_SYMBOL_MACOS_H */ diff --git a/source/dynlink/include/dynlink/dynlink_impl_symbol_unix.h b/source/dynlink/include/dynlink/dynlink_impl_symbol_unix.h deleted file mode 100644 index 56a66a91b..000000000 --- a/source/dynlink/include/dynlink/dynlink_impl_symbol_unix.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Dynamic Link Library by Parra Studios - * A library for dynamic loading and linking shared objects at run-time. - * - * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef DYNLINK_IMPL_SYMBOL_UNIX_H -#define DYNLINK_IMPL_SYMBOL_UNIX_H 1 - -/* -- Headers -- */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* -- Definitions -- */ - -#define DYNLINK_SYMBOL_PREFIX \ - dynlink_symbol_ - -/* -- Macros -- */ - -#define DYNLINK_SYMBOL_EXPORT(name) \ - DYNLINK_API struct dynlink_symbol_addr_unix_type DYNLINK_SYMBOL_NAME(name) = { \ - (dynlink_symbol_addr_unix_impl)&name \ - } - -#define DYNLINK_SYMBOL_GET(name) \ - ((dynlink_symbol_addr_unix)(name))->symbol - -/* -- Type definitions -- */ - -typedef void (*dynlink_symbol_addr_unix_impl)(void); - -typedef struct dynlink_symbol_addr_unix_type -{ - dynlink_symbol_addr_unix_impl symbol; -} * dynlink_symbol_addr_unix; - -typedef dynlink_symbol_addr_unix dynlink_symbol_addr; - -#ifdef __cplusplus -} -#endif - -#endif /* DYNLINK_IMPL_SYMBOL_UNIX_H */ diff --git a/source/dynlink/include/dynlink/dynlink_impl_symbol_win32.h b/source/dynlink/include/dynlink/dynlink_impl_symbol_win32.h deleted file mode 100644 index 670ece371..000000000 --- a/source/dynlink/include/dynlink/dynlink_impl_symbol_win32.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Dynamic Link Library by Parra Studios - * A library for dynamic loading and linking shared objects at run-time. - * - * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef DYNLINK_IMPL_SYMBOL_WIN32_H -#define DYNLINK_IMPL_SYMBOL_WIN32_H 1 - -/* -- Headers -- */ - -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* -- Definitions -- */ - -#define DYNLINK_SYMBOL_PREFIX - -/* -- Macros -- */ - -#define DYNLINK_SYMBOL_EXPORT(name) \ - DYNLINK_NO_EXPORT struct \ - { \ - char name; \ - } PREPROCESSOR_CONCAT(dynlink_no_export_, name) - -#define DYNLINK_SYMBOL_GET(name) name - -/* -- Type definitions -- */ - -typedef void (*dynlink_symbol_addr_win32)(void); - -typedef dynlink_symbol_addr_win32 dynlink_symbol_addr; - -#ifdef __cplusplus -} -#endif - -#endif /* DYNLINK_IMPL_SYMBOL_WIN32_H */ diff --git a/source/dynlink/include/dynlink/dynlink_impl_unix.h b/source/dynlink/include/dynlink/dynlink_impl_unix.h index 7cd53898b..cb239a1d8 100644 --- a/source/dynlink/include/dynlink/dynlink_impl_unix.h +++ b/source/dynlink/include/dynlink/dynlink_impl_unix.h @@ -25,8 +25,6 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/source/dynlink/include/dynlink/dynlink_impl_win32.h b/source/dynlink/include/dynlink/dynlink_impl_win32.h index 17daeb711..9bd39af77 100644 --- a/source/dynlink/include/dynlink/dynlink_impl_win32.h +++ b/source/dynlink/include/dynlink/dynlink_impl_win32.h @@ -25,8 +25,6 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/source/dynlink/include/dynlink/dynlink_interface.h b/source/dynlink/include/dynlink/dynlink_interface.h index b0f710c03..0a33fa608 100644 --- a/source/dynlink/include/dynlink/dynlink_interface.h +++ b/source/dynlink/include/dynlink/dynlink_interface.h @@ -28,18 +28,14 @@ #include #if defined(WIN32) || defined(_WIN32) - #include #include #elif defined(unix) || defined(__unix__) || defined(__unix) || \ defined(linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux) || \ (((defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__)) && (defined(MAC_OS_X_VERSION_10_15) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_15))) - #include #include #elif (defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__) - #include #include #elif defined(__HAIKU__) || defined(__BEOS__) - #include #include #else #error "Unsupported platform for dynlink" @@ -50,27 +46,10 @@ #include #include -#include - #ifdef __cplusplus extern "C" { #endif -/* -- Macros -- */ - -#define DYNLINK_SYMBOL_PREFIX_STR() \ - PREPROCESSOR_STRINGIFY_OR_EMPTY(DYNLINK_SYMBOL_PREFIX) - -#define DYNLINK_SYMBOL_NAME(name) \ - PREPROCESSOR_CONCAT(DYNLINK_SYMBOL_PREFIX, name) - -#define DYNLINK_SYMBOL_NAME_STR(name) \ - PREPROCESSOR_STRINGIFY(DYNLINK_SYMBOL_NAME(name)) - -#define DYNLINK_SYMBOL_STR(name) \ - DYNLINK_SYMBOL_PREFIX_STR() \ - name - /* -- Type definitions -- */ typedef dynlink_symbol_addr *dynlink_symbol_addr_ptr; diff --git a/source/dynlink/include/dynlink/dynlink_symbol.h b/source/dynlink/include/dynlink/dynlink_symbol.h deleted file mode 100644 index d0319663f..000000000 --- a/source/dynlink/include/dynlink/dynlink_symbol.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Dynamic Link Library by Parra Studios - * A library for dynamic loading and linking shared objects at run-time. - * - * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef DYNLINK_SYMBOL_H -#define DYNLINK_SYMBOL_H 1 - -/* -- Headers -- */ - -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* -- Definitions -- */ - -#define DYNLINK_SYMBOL_NAME_SIZE 0xFF - -/* -- Type Definitions -- */ - -typedef char dynlink_symbol_name_man[DYNLINK_SYMBOL_NAME_SIZE]; - -/* -- Methods -- */ - -/** -* @brief -* Get convert a symbol to name mangled for cross-platform dynamic loading -* -* @param[in] symbol_name -* Reference to name of the of dynamically linked shared object symbol -* -* @param[out] symbol_mangled -* Reference to mangled name of the of dynamically linked shared object symbol -* -* @return -* Returns zero if @symbol_name was correctly mangled -*/ -DYNLINK_API size_t dynlink_symbol_name_mangle(dynlink_symbol_name symbol_name, size_t symbol_name_length, dynlink_symbol_name_man symbol_mangled); - -#ifdef __cplusplus -} -#endif - -#endif /* DYNLINK_H */ diff --git a/source/dynlink/include/dynlink/dynlink_type.h b/source/dynlink/include/dynlink/dynlink_type.h index c883ec2da..7661172e7 100644 --- a/source/dynlink/include/dynlink/dynlink_type.h +++ b/source/dynlink/include/dynlink/dynlink_type.h @@ -44,6 +44,23 @@ typedef const char *dynlink_symbol_name; /**< Dynamically linked shared o typedef portability_library_path_str dynlink_library_path_str; /**< Dynamically linked shared object symbol name */ typedef void *dynlink_impl; /**< Dynamically linked shared object implementation */ typedef char dynlink_name_impl[PORTABILITY_PATH_SIZE]; /**< Allocated copy of dynamically linked shared object name */ +typedef void (*dynlink_symbol_addr)(void); /**< Function pointer referring to a symbol address */ + +/* -- Macros -- */ + +#define dynlink_symbol_cast(type, symbol, result) \ + do \ + { \ + union \ + { \ + type ptr; \ + dynlink_symbol_addr fn; \ + } cast; \ +\ + cast.ptr = (symbol); \ + (result) = cast.fn; \ +\ + } while (0) #ifdef __cplusplus } diff --git a/source/dynlink/source/dynlink_impl_beos.c b/source/dynlink/source/dynlink_impl_beos.c index 8ce81828f..bc28312af 100644 --- a/source/dynlink/source/dynlink_impl_beos.c +++ b/source/dynlink/source/dynlink_impl_beos.c @@ -85,7 +85,7 @@ int dynlink_impl_interface_symbol_beos(dynlink handle, dynlink_impl impl, dynlin return 1; } - *addr = (dynlink_symbol_addr)symbol; + dynlink_symbol_cast(void *, symbol, *addr); return (*addr == NULL); } diff --git a/source/dynlink/source/dynlink_impl_macos.c b/source/dynlink/source/dynlink_impl_macos.c index 6447c7390..672b39771 100644 --- a/source/dynlink/source/dynlink_impl_macos.c +++ b/source/dynlink/source/dynlink_impl_macos.c @@ -133,10 +133,11 @@ dynlink_impl dynlink_impl_interface_load_macos(dynlink handle) int dynlink_impl_interface_symbol_macos(dynlink handle, dynlink_impl impl, dynlink_symbol_name name, dynlink_symbol_addr *addr) { NSSymbol symbol = NSLookupSymbolInModule(impl, name); + void *symbol_addr = NSAddressOfSymbol(symbol); (void)handle; - *addr = (dynlink_symbol_addr)NSAddressOfSymbol(symbol); + dynlink_symbol_cast(void *, symbol_addr, *addr); return (*addr == NULL); } diff --git a/source/dynlink/source/dynlink_impl_unix.c b/source/dynlink/source/dynlink_impl_unix.c index a6455dd64..4c00300c6 100644 --- a/source/dynlink/source/dynlink_impl_unix.c +++ b/source/dynlink/source/dynlink_impl_unix.c @@ -105,7 +105,7 @@ int dynlink_impl_interface_symbol_unix(dynlink handle, dynlink_impl impl, dynlin (void)handle; - *addr = (dynlink_symbol_addr)symbol; + dynlink_symbol_cast(void *, symbol, *addr); return (*addr == NULL); } diff --git a/source/dynlink/source/dynlink_impl_win32.c b/source/dynlink/source/dynlink_impl_win32.c index 8ea74bb24..75d576f0f 100644 --- a/source/dynlink/source/dynlink_impl_win32.c +++ b/source/dynlink/source/dynlink_impl_win32.c @@ -76,7 +76,7 @@ int dynlink_impl_interface_symbol_win32(dynlink handle, dynlink_impl impl, dynli (void)handle; - *addr = (dynlink_symbol_addr)proc_addr; + dynlink_symbol_cast(FARPROC, proc_addr, *addr); return (*addr == NULL); } diff --git a/source/dynlink/source/dynlink_symbol.c b/source/dynlink/source/dynlink_symbol.c deleted file mode 100644 index 35ac3861d..000000000 --- a/source/dynlink/source/dynlink_symbol.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Dynamic Link Library by Parra Studios - * A library for dynamic loading and linking shared objects at run-time. - * - * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/* -- Headers -- */ - -#include -#include - -#include - -/* -- Methods -- */ - -size_t dynlink_symbol_name_mangle(dynlink_symbol_name symbol_name, size_t symbol_name_length, dynlink_symbol_name_man symbol_mangled) -{ - static const char symbol_prefix[] = DYNLINK_SYMBOL_PREFIX_STR(); - static size_t symbol_prefix_length = sizeof(symbol_prefix) - 1; - size_t length = symbol_name_length + symbol_prefix_length; - - if (symbol_mangled == NULL) - { - return length; - } - - if (symbol_prefix_length > 0) - { - memcpy(symbol_mangled, symbol_prefix, symbol_prefix_length); - } - - memcpy(&symbol_mangled[symbol_prefix_length], symbol_name, symbol_name_length); - - symbol_mangled[length] = '\0'; - - return length; -} diff --git a/source/extensions/plugin_extension/include/plugin_extension/plugin_extension.h b/source/extensions/plugin_extension/include/plugin_extension/plugin_extension.h index ef5d86dc5..7b6559913 100644 --- a/source/extensions/plugin_extension/include/plugin_extension/plugin_extension.h +++ b/source/extensions/plugin_extension/include/plugin_extension/plugin_extension.h @@ -23,16 +23,12 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif PLUGIN_EXTENSION_API int plugin_extension(void *loader, void *handle); -DYNLINK_SYMBOL_EXPORT(plugin_extension); - #ifdef __cplusplus } #endif diff --git a/source/loaders/c_loader/include/c_loader/c_loader.h b/source/loaders/c_loader/include/c_loader/c_loader.h index 0e083cb01..159d45a62 100644 --- a/source/loaders/c_loader/include/c_loader/c_loader.h +++ b/source/loaders/c_loader/include/c_loader/c_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif C_LOADER_API loader_impl_interface c_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(c_loader_impl_interface_singleton); - C_LOADER_API const char *c_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(c_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/cob_loader/include/cob_loader/cob_loader.h b/source/loaders/cob_loader/include/cob_loader/cob_loader.h index 92c6412aa..4344cf257 100644 --- a/source/loaders/cob_loader/include/cob_loader/cob_loader.h +++ b/source/loaders/cob_loader/include/cob_loader/cob_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif COB_LOADER_API loader_impl_interface cob_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(cob_loader_impl_interface_singleton); - COB_LOADER_API const char *cob_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(cob_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/cr_loader/include/cr_loader/cr_loader.h b/source/loaders/cr_loader/include/cr_loader/cr_loader.h index 628f387e6..33e01700f 100644 --- a/source/loaders/cr_loader/include/cr_loader/cr_loader.h +++ b/source/loaders/cr_loader/include/cr_loader/cr_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif CR_LOADER_API loader_impl_interface cr_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(cr_loader_impl_interface_singleton); - CR_LOADER_API const char *cr_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(cr_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/cs_loader/include/cs_loader/cs_loader.h b/source/loaders/cs_loader/include/cs_loader/cs_loader.h index 546a515ca..37aa49c71 100644 --- a/source/loaders/cs_loader/include/cs_loader/cs_loader.h +++ b/source/loaders/cs_loader/include/cs_loader/cs_loader.h @@ -13,20 +13,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif CS_LOADER_API loader_impl_interface cs_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(cs_loader_impl_interface_singleton); - CS_LOADER_API const char *cs_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(cs_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/dart_loader/include/dart_loader/dart_loader.h b/source/loaders/dart_loader/include/dart_loader/dart_loader.h index 8b6530480..15dab7185 100644 --- a/source/loaders/dart_loader/include/dart_loader/dart_loader.h +++ b/source/loaders/dart_loader/include/dart_loader/dart_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif DART_LOADER_API loader_impl_interface dart_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(dart_loader_impl_interface_singleton); - DART_LOADER_API const char *dart_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(dart_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/ext_loader/include/ext_loader/ext_loader.h b/source/loaders/ext_loader/include/ext_loader/ext_loader.h index 580ab2ff7..d1a9db118 100644 --- a/source/loaders/ext_loader/include/ext_loader/ext_loader.h +++ b/source/loaders/ext_loader/include/ext_loader/ext_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif EXT_LOADER_API loader_impl_interface ext_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(ext_loader_impl_interface_singleton); - EXT_LOADER_API const char *ext_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(ext_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/ext_loader/source/ext_loader_impl.cpp b/source/loaders/ext_loader/source/ext_loader_impl.cpp index 25b8385a5..caa235182 100644 --- a/source/loaders/ext_loader/source/ext_loader_impl.cpp +++ b/source/loaders/ext_loader/source/ext_loader_impl.cpp @@ -76,7 +76,7 @@ typedef struct loader_impl_ext_handle_type union loader_impl_function_cast { - void *ptr; + dynlink_symbol_addr ptr; int (*fn)(void *, void *); }; @@ -352,7 +352,7 @@ int ext_loader_impl_discover(loader_impl impl, loader_handle handle, context ctx { loader_impl_function_cast function_cast; - function_cast.ptr = static_cast(ext.addr); + function_cast.ptr = ext.addr; if (function_cast.fn(impl, loader_impl_handle_container_of(impl, handle)) != 0) { diff --git a/source/loaders/file_loader/include/file_loader/file_loader.h b/source/loaders/file_loader/include/file_loader/file_loader.h index b596e1537..4fff999e2 100644 --- a/source/loaders/file_loader/include/file_loader/file_loader.h +++ b/source/loaders/file_loader/include/file_loader/file_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif FILE_LOADER_API loader_impl_interface file_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(file_loader_impl_interface_singleton); - FILE_LOADER_API const char *file_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(file_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/java_loader/include/java_loader/java_loader.h b/source/loaders/java_loader/include/java_loader/java_loader.h index 4db5d86c2..b0aaa901d 100644 --- a/source/loaders/java_loader/include/java_loader/java_loader.h +++ b/source/loaders/java_loader/include/java_loader/java_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif JAVA_LOADER_API loader_impl_interface java_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(java_loader_impl_interface_singleton); - JAVA_LOADER_API const char *java_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(java_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/jl_loader/include/jl_loader/jl_loader.h b/source/loaders/jl_loader/include/jl_loader/jl_loader.h index 574e09504..02d588657 100644 --- a/source/loaders/jl_loader/include/jl_loader/jl_loader.h +++ b/source/loaders/jl_loader/include/jl_loader/jl_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif JL_LOADER_API loader_impl_interface jl_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(jl_loader_impl_interface_singleton); - JL_LOADER_API const char *jl_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(jl_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/js_loader/include/js_loader/js_loader.h b/source/loaders/js_loader/include/js_loader/js_loader.h index 7af1acf54..7bbcce7f7 100644 --- a/source/loaders/js_loader/include/js_loader/js_loader.h +++ b/source/loaders/js_loader/include/js_loader/js_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif JS_LOADER_API loader_impl_interface js_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(js_loader_impl_interface_singleton); - JS_LOADER_API const char *js_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(js_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/jsm_loader/include/jsm_loader/jsm_loader.h b/source/loaders/jsm_loader/include/jsm_loader/jsm_loader.h index b3d633549..6b74e7519 100644 --- a/source/loaders/jsm_loader/include/jsm_loader/jsm_loader.h +++ b/source/loaders/jsm_loader/include/jsm_loader/jsm_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif JSM_LOADER_API loader_impl_interface jsm_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(jsm_loader_impl_interface_singleton); - JSM_LOADER_API const char *jsm_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(jsm_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/llvm_loader/include/llvm_loader/llvm_loader.h b/source/loaders/llvm_loader/include/llvm_loader/llvm_loader.h index db405edd8..e395b8ccc 100644 --- a/source/loaders/llvm_loader/include/llvm_loader/llvm_loader.h +++ b/source/loaders/llvm_loader/include/llvm_loader/llvm_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif LLVM_LOADER_API loader_impl_interface llvm_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(llvm_loader_impl_interface_singleton); - LLVM_LOADER_API const char *llvm_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(llvm_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/lua_loader/include/lua_loader/lua_loader.h b/source/loaders/lua_loader/include/lua_loader/lua_loader.h index f93ed5312..811750907 100644 --- a/source/loaders/lua_loader/include/lua_loader/lua_loader.h +++ b/source/loaders/lua_loader/include/lua_loader/lua_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif LUA_LOADER_API loader_impl_interface lua_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(lua_loader_impl_interface_singleton); - LUA_LOADER_API const char *lua_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(lua_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/mock_loader/include/mock_loader/mock_loader.h b/source/loaders/mock_loader/include/mock_loader/mock_loader.h index f92e7d1dd..2f0302fdf 100644 --- a/source/loaders/mock_loader/include/mock_loader/mock_loader.h +++ b/source/loaders/mock_loader/include/mock_loader/mock_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif MOCK_LOADER_API loader_impl_interface mock_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(mock_loader_impl_interface_singleton); - MOCK_LOADER_API const char *mock_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(mock_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index 70108f53e..a9bf13c67 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -158,7 +158,7 @@ target_link_libraries(${target} ${META_PROJECT_NAME}::metacall # MetaCall library # TODO: Implement delayed load - # ${NodeJS_LIBRARY} # NodeJS library + ${NodeJS_LIBRARY} # NodeJS library PUBLIC ${DEFAULT_LIBRARIES} diff --git a/source/loaders/node_loader/include/node_loader/node_loader.h b/source/loaders/node_loader/include/node_loader/node_loader.h index 866037639..84b1009be 100644 --- a/source/loaders/node_loader/include/node_loader/node_loader.h +++ b/source/loaders/node_loader/include/node_loader/node_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif NODE_LOADER_API loader_impl_interface node_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(node_loader_impl_interface_singleton); - NODE_LOADER_API const char *node_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(node_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/node_loader/source/node_loader_impl.cpp b/source/loaders/node_loader/source/node_loader_impl.cpp index af983d29d..720c7b1a2 100644 --- a/source/loaders/node_loader/source/node_loader_impl.cpp +++ b/source/loaders/node_loader/source/node_loader_impl.cpp @@ -783,27 +783,35 @@ static HMODULE (*get_module_handle_a_ptr)(_In_opt_ LPCSTR) = NULL; /* TODO: Impl /* -- Methods -- */ +#if NODE_MAJOR_VERSION >= 12 + #define node_loader_impl_register_module_id node::ModuleFlags::kLinked | 0x08 /* NM_F_DELETEME */ +#else + #define node_loader_impl_register_module_id 0x02 | 0x08 /* NM_F_LINKED | NM_F_DELETEME */ +#endif + #if 1 // NODE_MAJOR_VERSION < 18 - #if NODE_MAJOR_VERSION >= 12 - #define node_loader_impl_register_module_id node::ModuleFlags::kLinked | 0x08 /* NM_F_DELETEME */ - #else - #define node_loader_impl_register_module_id 0x02 | 0x08 /* NM_F_LINKED | NM_F_DELETEME */ - #endif + #define node_loader_impl_register_binding(module) \ + napi_module_register(&module) +#else + // TODO: This won't work, this must be run after NodeJS has initialized and passing the environment + #define node_loader_impl_register_binding(module) \ + AddLinkedBinding(nullptr, module) +#endif - #define node_loader_impl_register_module(name, fn) \ - do \ - { \ - static napi_module node_loader_module = { \ - NAPI_MODULE_VERSION, \ - node_loader_impl_register_module_id, \ - __FILE__, \ - fn, \ - name, \ - NULL, \ - { 0 } \ - }; \ - napi_module_register(&node_loader_module); \ - } while (0) +#define node_loader_impl_register_module(name, fn) \ + do \ + { \ + static napi_module node_loader_module = { \ + NAPI_MODULE_VERSION, \ + node_loader_impl_register_module_id, \ + __FILE__, \ + fn, \ + name, \ + NULL, \ + { 0 } \ + }; \ + node_loader_impl_register_binding(node_loader_module); \ + } while (0) void node_loader_impl_register_linked_bindings() { @@ -813,9 +821,6 @@ void node_loader_impl_register_linked_bindings() /* Initialize Node Loader Port */ node_loader_impl_register_module("node_loader_port_module", node_loader_port_initialize); } -#else -// TODO: New register implementation -#endif void node_loader_impl_exception(napi_env env, napi_status status) { @@ -3806,9 +3811,8 @@ void node_loader_impl_thread(void *data) #endif */ - // #if NODE_MAJOR_VERSION < 18 + /* Register bindings */ node_loader_impl_register_linked_bindings(); - // #endif /* Unlock node implementation mutex */ uv_mutex_unlock(&node_impl->mutex); diff --git a/source/loaders/py_loader/include/py_loader/py_loader.h b/source/loaders/py_loader/include/py_loader/py_loader.h index 0e655cdb8..cdc88d415 100644 --- a/source/loaders/py_loader/include/py_loader/py_loader.h +++ b/source/loaders/py_loader/include/py_loader/py_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif PY_LOADER_API loader_impl_interface py_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(py_loader_impl_interface_singleton); - PY_LOADER_API const char *py_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(py_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/rb_loader/include/rb_loader/rb_loader.h b/source/loaders/rb_loader/include/rb_loader/rb_loader.h index 49b53024c..4d727e507 100644 --- a/source/loaders/rb_loader/include/rb_loader/rb_loader.h +++ b/source/loaders/rb_loader/include/rb_loader/rb_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif RB_LOADER_API loader_impl_interface rb_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(rb_loader_impl_interface_singleton); - RB_LOADER_API const char *rb_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(rb_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/rpc_loader/include/rpc_loader/rpc_loader.h b/source/loaders/rpc_loader/include/rpc_loader/rpc_loader.h index de574b4b8..a4e399d16 100644 --- a/source/loaders/rpc_loader/include/rpc_loader/rpc_loader.h +++ b/source/loaders/rpc_loader/include/rpc_loader/rpc_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif RPC_LOADER_API loader_impl_interface rpc_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(rpc_loader_impl_interface_singleton); - RPC_LOADER_API const char *rpc_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(rpc_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/rs_loader/include/rs_loader/rs_loader.h b/source/loaders/rs_loader/include/rs_loader/rs_loader.h index 75f961a33..61e9c11e8 100644 --- a/source/loaders/rs_loader/include/rs_loader/rs_loader.h +++ b/source/loaders/rs_loader/include/rs_loader/rs_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif RS_LOADER_API loader_impl_interface rs_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(rs_loader_impl_interface_singleton); - RS_LOADER_API const char *rs_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(rs_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/ts_loader/include/ts_loader/ts_loader.h b/source/loaders/ts_loader/include/ts_loader/ts_loader.h index 812c4c249..b433fd941 100644 --- a/source/loaders/ts_loader/include/ts_loader/ts_loader.h +++ b/source/loaders/ts_loader/include/ts_loader/ts_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif TS_LOADER_API loader_impl_interface ts_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(ts_loader_impl_interface_singleton); - TS_LOADER_API const char *ts_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(ts_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/loaders/wasm_loader/include/wasm_loader/wasm_loader.h b/source/loaders/wasm_loader/include/wasm_loader/wasm_loader.h index b34e2a5d1..067ea4856 100644 --- a/source/loaders/wasm_loader/include/wasm_loader/wasm_loader.h +++ b/source/loaders/wasm_loader/include/wasm_loader/wasm_loader.h @@ -25,20 +25,14 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif WASM_LOADER_API loader_impl_interface wasm_loader_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(wasm_loader_impl_interface_singleton); - WASM_LOADER_API const char *wasm_loader_print_info(void); -DYNLINK_SYMBOL_EXPORT(wasm_loader_print_info); - #ifdef __cplusplus } #endif diff --git a/source/metacall/source/metacall.c b/source/metacall/source/metacall.c index 8a9ad2eb9..a5beb250c 100644 --- a/source/metacall/source/metacall.c +++ b/source/metacall/source/metacall.c @@ -72,6 +72,65 @@ static type_id *metacall_type_ids(void *args[], size_t size); /* -- Costructors -- */ +/* TODO: Test, abstract and remove this */ +/* +#include + +extern void *__libc_dlsym(void *map, const char *name); +extern void *__libc_dlopen_mode(const char *name, int mode); + +typedef void *(*dynlink_dlsym_fn)(void *, const char *); + +static dynlink_dlsym_fn dynlink_dlsym_fn_ptr = NULL; + +int dynlink_dlsym_initialize(void) +{ + void *handle = __libc_dlopen_mode("libdl.so.2", RTLD_GLOBAL | RTLD_LAZY); + union + { + void *ptr; + dynlink_dlsym_fn fn; + } cast; + + if (handle == NULL) + { + return 1; + } + + cast.ptr = __libc_dlsym(handle, "dlsym"); + + if (cast.ptr == NULL) + { + return 1; + } + + dynlink_dlsym_fn_ptr = cast.fn; + + return 0; +} + +void *dynlink_dlsym(void *handle, const char *symbol) +{ + if (dynlink_dlsym_fn_ptr == NULL) + { + if (dynlink_dlsym_initialize() != 0) + { + return NULL; + } + } + + return dynlink_dlsym_fn_ptr(handle, symbol); +} + +void *dlsym(void *handle, const char *symbol) +{ + printf("HANDLE %p - Symbol: %s\n", handle, symbol); + + return dynlink_dlsym(handle, symbol); +} +*/ +/* TODO-END */ + portability_constructor(metacall_constructor) { if (metacall_initialize_flag == 1) diff --git a/source/plugin/source/plugin_descriptor.c b/source/plugin/source/plugin_descriptor.c index 491895e05..00f463079 100644 --- a/source/plugin/source/plugin_descriptor.c +++ b/source/plugin/source/plugin_descriptor.c @@ -65,7 +65,7 @@ plugin_descriptor plugin_descriptor_create(char *path, char *library_name, char return NULL; } - descriptor->iface_singleton = (void *(*)(void))DYNLINK_SYMBOL_GET(address); + descriptor->iface_singleton = (void *(*)(void))(address); if (descriptor->iface_singleton == NULL) { diff --git a/source/plugin/source/plugin_loader.c b/source/plugin/source/plugin_loader.c index 5212f7ebb..a88ccda71 100644 --- a/source/plugin/source/plugin_loader.c +++ b/source/plugin/source/plugin_loader.c @@ -178,20 +178,19 @@ char *plugin_loader_generate_library_name(const char *name, char *suffix) char *plugin_loader_generate_symbol_iface_name(const char *name, char *suffix) { size_t name_length = strlen(name); - size_t mangle_length = dynlink_symbol_name_mangle(name, name_length, NULL); size_t suffix_length = strlen(suffix); - char *symbol_iface_name = malloc(sizeof(char) * (mangle_length + suffix_length + 1)); + char *symbol_iface_name = malloc(sizeof(char) * (name_length + suffix_length + 1)); if (symbol_iface_name == NULL) { return NULL; } - dynlink_symbol_name_mangle(name, name_length, symbol_iface_name); + memcpy(symbol_iface_name, name, name_length); - memcpy(&symbol_iface_name[mangle_length], suffix, suffix_length); + memcpy(&symbol_iface_name[name_length], suffix, suffix_length); - symbol_iface_name[mangle_length + suffix_length] = '\0'; + symbol_iface_name[name_length + suffix_length] = '\0'; return symbol_iface_name; } diff --git a/source/plugins/backtrace_plugin/include/backtrace_plugin/backtrace_plugin.h b/source/plugins/backtrace_plugin/include/backtrace_plugin/backtrace_plugin.h index 5269713f9..7a2ce1f07 100644 --- a/source/plugins/backtrace_plugin/include/backtrace_plugin/backtrace_plugin.h +++ b/source/plugins/backtrace_plugin/include/backtrace_plugin/backtrace_plugin.h @@ -23,16 +23,12 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif BACKTRACE_PLUGIN_API int backtrace_plugin(void *loader, void *handle); -DYNLINK_SYMBOL_EXPORT(backtrace_plugin); - #ifdef __cplusplus } #endif diff --git a/source/plugins/sandbox_plugin/include/sandbox_plugin/sandbox_plugin.h b/source/plugins/sandbox_plugin/include/sandbox_plugin/sandbox_plugin.h index 12d8c2caf..68d6d23f4 100644 --- a/source/plugins/sandbox_plugin/include/sandbox_plugin/sandbox_plugin.h +++ b/source/plugins/sandbox_plugin/include/sandbox_plugin/sandbox_plugin.h @@ -23,16 +23,12 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif SANDBOX_PLUGIN_API int sandbox_plugin(void *loader, void *handle); -DYNLINK_SYMBOL_EXPORT(sandbox_plugin); - #ifdef __cplusplus } #endif diff --git a/source/scripts/extension/sum/include/sum_extension/sum_extension.h b/source/scripts/extension/sum/include/sum_extension/sum_extension.h index 4dd93bc04..386bd4d76 100644 --- a/source/scripts/extension/sum/include/sum_extension/sum_extension.h +++ b/source/scripts/extension/sum/include/sum_extension/sum_extension.h @@ -23,16 +23,12 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif SUM_EXTENSION_API int sum_extension(void *loader, void *handle); -DYNLINK_SYMBOL_EXPORT(sum_extension); - #ifdef __cplusplus } #endif diff --git a/source/serials/metacall_serial/include/metacall_serial/metacall_serial.h b/source/serials/metacall_serial/include/metacall_serial/metacall_serial.h index 5d4f2e119..fb80de34c 100644 --- a/source/serials/metacall_serial/include/metacall_serial/metacall_serial.h +++ b/source/serials/metacall_serial/include/metacall_serial/metacall_serial.h @@ -27,8 +27,6 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif @@ -45,8 +43,6 @@ extern "C" { */ METACALL_SERIAL_API serial_interface metacall_serial_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(metacall_serial_impl_interface_singleton); - /** * @brief * Provide the module information @@ -57,8 +53,6 @@ DYNLINK_SYMBOL_EXPORT(metacall_serial_impl_interface_singleton); */ METACALL_SERIAL_API const char *metacall_serial_print_info(void); -DYNLINK_SYMBOL_EXPORT(metacall_serial_print_info); - #ifdef __cplusplus } #endif diff --git a/source/serials/rapid_json_serial/include/rapid_json_serial/rapid_json_serial.h b/source/serials/rapid_json_serial/include/rapid_json_serial/rapid_json_serial.h index 51e32e3b8..106acb20e 100644 --- a/source/serials/rapid_json_serial/include/rapid_json_serial/rapid_json_serial.h +++ b/source/serials/rapid_json_serial/include/rapid_json_serial/rapid_json_serial.h @@ -27,8 +27,6 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif @@ -45,8 +43,6 @@ extern "C" { */ RAPID_JSON_SERIAL_API serial_interface rapid_json_serial_impl_interface_singleton(void); -DYNLINK_SYMBOL_EXPORT(rapid_json_serial_impl_interface_singleton); - /** * @brief * Provide the module information @@ -57,8 +53,6 @@ DYNLINK_SYMBOL_EXPORT(rapid_json_serial_impl_interface_singleton); */ RAPID_JSON_SERIAL_API const char *rapid_json_serial_print_info(void); -DYNLINK_SYMBOL_EXPORT(rapid_json_serial_print_info); - #ifdef __cplusplus } #endif diff --git a/source/tests/dynlink_test/source/dynlink_test.cpp b/source/tests/dynlink_test/source/dynlink_test.cpp index dc77a7c6b..3d69b74a2 100644 --- a/source/tests/dynlink_test/source/dynlink_test.cpp +++ b/source/tests/dynlink_test/source/dynlink_test.cpp @@ -68,17 +68,17 @@ TEST_F(dynlink_test, DefaultConstructor) { static dynlink_symbol_addr mock_loader_print_info_addr; - EXPECT_EQ((int)0, dynlink_symbol(handle, DYNLINK_SYMBOL_STR("mock_loader_print_info"), &mock_loader_print_info_addr)); + EXPECT_EQ((int)0, dynlink_symbol(handle, "mock_loader_print_info", &mock_loader_print_info_addr)); if (mock_loader_print_info_addr != NULL) { - mock_loader_print_func print = DYNLINK_SYMBOL_GET(mock_loader_print_info_addr); + mock_loader_print_func print = mock_loader_print_info_addr; log_write("metacall", LOG_LEVEL_DEBUG, "Print function: %p", (void *)print); log_write("metacall", LOG_LEVEL_DEBUG, "Symbol pointer: %p", (void *)mock_loader_print_info_addr); - if (DYNLINK_SYMBOL_GET(mock_loader_print_info_addr) != NULL) + if (mock_loader_print_info_addr != NULL) { log_write("metacall", LOG_LEVEL_DEBUG, "Pointer is valid"); } From cbbf4a45a81e306ab3374d3f81758c28c362aa15 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 28 Nov 2024 21:14:33 +0100 Subject: [PATCH 05/66] Solve issues from detours, plugin manager, fork safety and added support to mingw in dynlink. --- .../funchook_detour/scripts/download.bat.in | 6 +++--- .../detours/funchook_detour/scripts/download.sh.in | 10 ++++------ source/dynlink/source/dynlink_impl_win32.c | 6 ++++++ source/metacall/source/metacall_fork.c | 4 ++-- source/plugin/source/plugin_manager.c | 14 +++++++------- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/source/detours/funchook_detour/scripts/download.bat.in b/source/detours/funchook_detour/scripts/download.bat.in index 8f1fd3842..a2702001b 100755 --- a/source/detours/funchook_detour/scripts/download.bat.in +++ b/source/detours/funchook_detour/scripts/download.bat.in @@ -1,11 +1,11 @@ @echo on rem Download repository if it does not exist -if not exist @FUNCHOOK_SOURCE_DIR@/.git ( - if exist @FUNCHOOK_SOURCE_DIR@ ( +if not exist "@FUNCHOOK_SOURCE_DIR@/.git" ( + if exist "@FUNCHOOK_SOURCE_DIR@" ( rmdir /S /Q "@FUNCHOOK_SOURCE_DIR@" ) - "@GIT_EXECUTABLE@" clone --single-branch --branch v@FUNCHOOK_VERSION@ --recursive https://github.com/kubo/funchook.git @FUNCHOOK_SOURCE_DIR@ + "@GIT_EXECUTABLE@" clone --single-branch --branch v@FUNCHOOK_VERSION@ --recursive https://github.com/kubo/funchook.git "@FUNCHOOK_SOURCE_DIR@" ) rem Write empty CMake file to avoid cmake warnings diff --git a/source/detours/funchook_detour/scripts/download.sh.in b/source/detours/funchook_detour/scripts/download.sh.in index 946485c7b..122a268bf 100755 --- a/source/detours/funchook_detour/scripts/download.sh.in +++ b/source/detours/funchook_detour/scripts/download.sh.in @@ -1,11 +1,9 @@ #!/usr/bin/env sh # Download repository if it does not exist -if [ ! -d @FUNCHOOK_SOURCE_DIR@/.git ] -then - if [ -d @FUNCHOOK_SOURCE_DIR@ ] - then - rm -rf @FUNCHOOK_SOURCE_DIR@ +if [ ! -d "@FUNCHOOK_SOURCE_DIR@/.git" ]; then + if [ -d "@FUNCHOOK_SOURCE_DIR@" ]; then + rm -rf "@FUNCHOOK_SOURCE_DIR@" fi - @GIT_EXECUTABLE@ clone --single-branch --branch v@FUNCHOOK_VERSION@ --recursive https://github.com/kubo/funchook.git @FUNCHOOK_SOURCE_DIR@ + "@GIT_EXECUTABLE@" clone --single-branch --branch v@FUNCHOOK_VERSION@ --recursive https://github.com/kubo/funchook.git "@FUNCHOOK_SOURCE_DIR@" fi diff --git a/source/dynlink/source/dynlink_impl_win32.c b/source/dynlink/source/dynlink_impl_win32.c index 75d576f0f..60532c463 100644 --- a/source/dynlink/source/dynlink_impl_win32.c +++ b/source/dynlink/source/dynlink_impl_win32.c @@ -41,7 +41,13 @@ const char *dynlink_impl_interface_extension_win32(void) void dynlink_impl_interface_get_name_win32(dynlink_name name, dynlink_name_impl name_impl, size_t size) { +#if defined(__MINGW32__) || defined(__MINGW64__) + strncpy(name_impl, "lib", size); + + strncat(name_impl, name, size - 1); +#else strncpy(name_impl, name, size); +#endif strncat(name_impl, ".", size - 1); diff --git a/source/metacall/source/metacall_fork.c b/source/metacall/source/metacall_fork.c index 8eea459f8..67bcfd6a3 100644 --- a/source/metacall/source/metacall_fork.c +++ b/source/metacall/source/metacall_fork.c @@ -212,7 +212,7 @@ NTSTATUS NTAPI metacall_fork_hook(ULONG ProcessFlags, void (*metacall_fork_func(void))(void) { - return (void (*)(void)) & fork; + return (void (*)(void))(&fork); } pid_t metacall_fork_hook(void) @@ -325,7 +325,7 @@ int metacall_fork_initialize(void) if (metacall_detour_handle == NULL) { - metacall_detour_handle = detour_install(metacall_detour, (void (*)(void))fork_func, (void (*)(void)) & metacall_fork_hook); + metacall_detour_handle = detour_install(metacall_detour, (void (*)(void))fork_func, (void (*)(void))(&metacall_fork_hook)); if (metacall_detour_handle == NULL) { diff --git a/source/plugin/source/plugin_manager.c b/source/plugin/source/plugin_manager.c index d3c06044b..f60155fe6 100644 --- a/source/plugin/source/plugin_manager.c +++ b/source/plugin/source/plugin_manager.c @@ -138,16 +138,16 @@ int plugin_manager_initialize(plugin_manager manager, const char *name, const ch return 1; } - } - /* On Windows, pass the library path to the loader so it can find the dependencies of the plugins */ - /* For more information: https://github.com/metacall/core/issues/479 */ + /* On Windows, pass the library path to the loader so it can find the dependencies of the plugins */ + /* For more information: https://github.com/metacall/core/issues/479 */ #if defined(WIN32) || defined(_WIN32) - if (SetDllDirectoryA(manager->library_path) == FALSE) - { - log_write("metacall", LOG_LEVEL_ERROR, "Failed to register the DLL directory %s; plugins with other dependant DLLs may fail to load", manager->library_path); - } + if (SetDllDirectoryA(manager->library_path) == FALSE) + { + log_write("metacall", LOG_LEVEL_ERROR, "Failed to register the DLL directory %s; plugins with other dependant DLLs may fail to load", manager->library_path); + } #endif + } /* Initialize the plugin loader */ if (manager->l == NULL) From 1927c6252b4b9e6fc1bdfde0b93eb227184f3ab2 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 28 Nov 2024 23:58:12 +0100 Subject: [PATCH 06/66] Unified all detours modules, add a destructor in metacall module for detours, add base for metacall link. --- source/metacall/CMakeLists.txt | 2 + source/metacall/include/metacall/metacall.h | 10 ++ .../metacall/include/metacall/metacall_link.h | 58 ++++++++ source/metacall/source/metacall.c | 126 +++++++++--------- source/metacall/source/metacall_fork.c | 99 +++----------- source/metacall/source/metacall_link.c | 117 ++++++++++++++++ 6 files changed, 265 insertions(+), 147 deletions(-) create mode 100644 source/metacall/include/metacall/metacall_link.h create mode 100644 source/metacall/source/metacall_link.c diff --git a/source/metacall/CMakeLists.txt b/source/metacall/CMakeLists.txt index 87146dc9b..1ab5be1fa 100644 --- a/source/metacall/CMakeLists.txt +++ b/source/metacall/CMakeLists.txt @@ -56,6 +56,7 @@ set(headers ${include_path}/metacall_log.h ${include_path}/metacall_allocator.h ${include_path}/metacall_error.h + ${include_path}/metacall_link.h ) set(sources @@ -64,6 +65,7 @@ set(sources ${source_path}/metacall_log.c ${source_path}/metacall_allocator.c ${source_path}/metacall_error.c + ${source_path}/metacall_link.c ) if(OPTION_FORK_SAFE) diff --git a/source/metacall/include/metacall/metacall.h b/source/metacall/include/metacall/metacall.h index 3e841fdcf..2ad427ca3 100644 --- a/source/metacall/include/metacall/metacall.h +++ b/source/metacall/include/metacall/metacall.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -96,6 +97,15 @@ METACALL_API extern void *metacall_null_args[1]; */ METACALL_API const char *metacall_serial(void); +/** +* @brief +* Returns default detour used by MetaCall +* +* @return +* Name of the detour to be used with detouring methods +*/ +METACALL_API const char *metacall_detour(void); + /** * @brief * Disables MetaCall logs, must be called before @metacall_initialize. diff --git a/source/metacall/include/metacall/metacall_link.h b/source/metacall/include/metacall/metacall_link.h new file mode 100644 index 000000000..b0665a824 --- /dev/null +++ b/source/metacall/include/metacall/metacall_link.h @@ -0,0 +1,58 @@ +/* + * MetaCall Library by Parra Studios + * A library for providing a foreign function interface calls. + * + * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef METACALL_LINK_H +#define METACALL_LINK_H 1 + +/* -- Headers -- */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* -- Methods -- */ + +/** +* @brief +* Initialize link detours and allocate shared memory +* +* @return +* Zero if success, different from zero otherwise +*/ +METACALL_API int metacall_link_initialize(void); + +// TODO: Implement dlsym hook function table + +/** +* @brief +* Unregister link detours and destroy shared memory +* +* @return +* Zero if success, different from zero otherwise +*/ +METACALL_API int metacall_link_destroy(void); + +#ifdef __cplusplus +} +#endif + +#endif /* METACALL_LINK_H */ diff --git a/source/metacall/source/metacall.c b/source/metacall/source/metacall.c index a5beb250c..02ab3deaa 100644 --- a/source/metacall/source/metacall.c +++ b/source/metacall/source/metacall.c @@ -33,6 +33,8 @@ #include +#include + #include #include @@ -44,6 +46,7 @@ #define METACALL_ARGS_SIZE 0x10 #define METACALL_SERIAL "rapid_json" +#define METACALL_DETOUR "funchook" /* -- Type Definitions -- */ @@ -69,68 +72,10 @@ static loader_path plugin_path = { 0 }; static int metacall_plugin_extension_load(void); static void *metacallv_method(void *target, const char *name, method_invoke_ptr call, vector v, void *args[], size_t size); static type_id *metacall_type_ids(void *args[], size_t size); +static void metacall_detour_destructor(void); /* -- Costructors -- */ -/* TODO: Test, abstract and remove this */ -/* -#include - -extern void *__libc_dlsym(void *map, const char *name); -extern void *__libc_dlopen_mode(const char *name, int mode); - -typedef void *(*dynlink_dlsym_fn)(void *, const char *); - -static dynlink_dlsym_fn dynlink_dlsym_fn_ptr = NULL; - -int dynlink_dlsym_initialize(void) -{ - void *handle = __libc_dlopen_mode("libdl.so.2", RTLD_GLOBAL | RTLD_LAZY); - union - { - void *ptr; - dynlink_dlsym_fn fn; - } cast; - - if (handle == NULL) - { - return 1; - } - - cast.ptr = __libc_dlsym(handle, "dlsym"); - - if (cast.ptr == NULL) - { - return 1; - } - - dynlink_dlsym_fn_ptr = cast.fn; - - return 0; -} - -void *dynlink_dlsym(void *handle, const char *symbol) -{ - if (dynlink_dlsym_fn_ptr == NULL) - { - if (dynlink_dlsym_initialize() != 0) - { - return NULL; - } - } - - return dynlink_dlsym_fn_ptr(handle, symbol); -} - -void *dlsym(void *handle, const char *symbol) -{ - printf("HANDLE %p - Symbol: %s\n", handle, symbol); - - return dynlink_dlsym(handle, symbol); -} -*/ -/* TODO-END */ - portability_constructor(metacall_constructor) { if (metacall_initialize_flag == 1) @@ -179,6 +124,13 @@ const char *metacall_serial(void) return metacall_serial_str; } +const char *metacall_detour(void) +{ + static const char metacall_detour_str[] = METACALL_DETOUR; + + return metacall_detour_str; +} + void metacall_log_null(void) { metacall_log_null_flag = 0; @@ -237,6 +189,31 @@ int metacall_plugin_extension_load(void) return result; } +void metacall_detour_destructor(void) +{ + log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall detour destruction"); + + /* Destroy link */ + if (metacall_link_destroy() != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "Invalid MetaCall link destruction"); + } + + /* Destroy fork */ +#ifdef METACALL_FORK_SAFE + if (metacall_config_flags & METACALL_FLAGS_FORK_SAFE) + { + if (metacall_fork_destroy() != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "Invalid MetaCall fork destruction"); + } + } +#endif /* METACALL_FORK_SAFE */ + + /* Destroy detour */ + detour_destroy(); +} + int metacall_initialize(void) { memory_allocator allocator; @@ -272,18 +249,37 @@ int metacall_initialize(void) return 1; } -#ifdef METACALL_FORK_SAFE - if (metacall_config_flags & METACALL_FLAGS_FORK_SAFE) + /* Initialize detours */ { - if (metacall_fork_initialize() != 0) + if (detour_initialize() != 0) { - log_write("metacall", LOG_LEVEL_ERROR, "Invalid MetaCall fork initialization"); + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour initialization"); + return 1; } - log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall fork initialized"); - } + /* Initialize link */ + if (metacall_link_initialize() != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "Invalid MetaCall link initialization"); + } + +#ifdef METACALL_FORK_SAFE + if (metacall_config_flags & METACALL_FLAGS_FORK_SAFE) + { + if (metacall_fork_initialize() != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "Invalid MetaCall fork initialization"); + } + + log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall fork initialized"); + } #endif /* METACALL_FORK_SAFE */ + /* Define destructor for detouring (it must be executed at the end to prevent problems with fork mechanisms) */ + atexit(metacall_detour_destructor); + } + + /* Initialize configuration and serializer */ allocator = memory_allocator_std(&malloc, &realloc, &free); if (configuration_initialize(metacall_serial(), NULL, allocator) != 0) diff --git a/source/metacall/source/metacall_fork.c b/source/metacall/source/metacall_fork.c index 67bcfd6a3..379a1a61c 100644 --- a/source/metacall/source/metacall_fork.c +++ b/source/metacall/source/metacall_fork.c @@ -102,17 +102,11 @@ pid_t metacall_fork_hook(void); /* -- Private Variables -- */ -static const char metacall_fork_detour_name[] = "funchook"; - -static detour metacall_detour = NULL; - -static detour_handle metacall_detour_handle = NULL; +static detour_handle detour_fork_handle = NULL; static metacall_pre_fork_callback_ptr metacall_pre_fork_callback = NULL; static metacall_post_fork_callback_ptr metacall_post_fork_callback = NULL; -static int metacall_fork_flag = 1; - /* -- Methods -- */ #if defined(WIN32) || defined(_WIN32) || \ @@ -142,7 +136,7 @@ NTSTATUS NTAPI metacall_fork_hook(ULONG ProcessFlags, HANDLE DebugPort, PRTL_USER_PROCESS_INFORMATION ProcessInformation) { - RtlCloneUserProcessPtr metacall_fork_trampoline = (RtlCloneUserProcessPtr)detour_trampoline(metacall_detour_handle); + RtlCloneUserProcessPtr metacall_fork_trampoline = (RtlCloneUserProcessPtr)detour_trampoline(detour_fork_handle); metacall_pre_fork_callback_ptr pre_callback = metacall_pre_fork_callback; metacall_post_fork_callback_ptr post_callback = metacall_post_fork_callback; @@ -159,7 +153,7 @@ NTSTATUS NTAPI metacall_fork_hook(ULONG ProcessFlags, /* TODO: Context */ if (pre_callback(NULL) != 0) { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour pre callback invocation"); + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour pre fork callback invocation"); } } @@ -198,7 +192,7 @@ NTSTATUS NTAPI metacall_fork_hook(ULONG ProcessFlags, /* TODO: Context */ if (post_callback(_getpid(), NULL) != 0) { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour post callback invocation"); + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour post fork callback invocation"); } } @@ -217,7 +211,7 @@ void (*metacall_fork_func(void))(void) pid_t metacall_fork_hook(void) { - pid_t (*metacall_fork_trampoline)(void) = (pid_t(*)(void))detour_trampoline(metacall_detour_handle); + pid_t (*metacall_fork_trampoline)(void) = (pid_t(*)(void))detour_trampoline(detour_fork_handle); metacall_pre_fork_callback_ptr pre_callback = metacall_pre_fork_callback; metacall_post_fork_callback_ptr post_callback = metacall_post_fork_callback; @@ -234,7 +228,7 @@ pid_t metacall_fork_hook(void) /* TODO: Context */ if (pre_callback(NULL) != 0) { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour pre callback invocation"); + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour pre fork callback invocation"); } } @@ -268,7 +262,7 @@ pid_t metacall_fork_hook(void) /* TODO: Context */ if (post_callback(pid, NULL) != 0) { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour post callback invocation"); + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour post fork callback invocation"); } } @@ -279,57 +273,17 @@ pid_t metacall_fork_hook(void) #error "Unknown metacall fork safety platform" #endif -static void metacall_fork_exit(void) -{ - log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall atexit triggered"); - - if (metacall_fork_destroy() != 0) - { - log_write("metacall", LOG_LEVEL_ERROR, "Invalid MetaCall fork destruction"); - } - - log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall fork destroyed"); -} - int metacall_fork_initialize(void) { - void (*fork_func)(void) = metacall_fork_func(); - - if (fork_func == NULL) - { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid fork function pointer"); - - return 1; - } - - if (detour_initialize() != 0) - { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour initialization"); - - return 1; - } - - if (metacall_detour == NULL) - { - metacall_detour = detour_create(metacall_fork_detour_name); + detour d = detour_create(metacall_detour()); - if (metacall_detour == NULL) - { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour creation"); - - metacall_fork_destroy(); - - return 1; - } - } - - if (metacall_detour_handle == NULL) + if (detour_fork_handle == NULL) { - metacall_detour_handle = detour_install(metacall_detour, (void (*)(void))fork_func, (void (*)(void))(&metacall_fork_hook)); + detour_fork_handle = detour_install(d, (void (*)(void))metacall_fork_func(), (void (*)(void))(&metacall_fork_hook)); - if (metacall_detour_handle == NULL) + if (detour_fork_handle == NULL) { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour installation"); + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour fork installation"); metacall_fork_destroy(); @@ -337,13 +291,6 @@ int metacall_fork_initialize(void) } } - if (metacall_fork_flag == 1) - { - atexit(&metacall_fork_exit); - - metacall_fork_flag = 0; - } - return 0; } @@ -357,32 +304,20 @@ int metacall_fork_destroy(void) { int result = 0; - if (metacall_detour_handle != NULL) + if (detour_fork_handle != NULL) { - if (detour_uninstall(metacall_detour, metacall_detour_handle) != 0) - { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour uninstall"); - - result = 1; - } - - metacall_detour_handle = NULL; - } + detour d = detour_create(metacall_detour()); - if (metacall_detour != NULL) - { - if (detour_clear(metacall_detour) != 0) + if (detour_uninstall(d, detour_fork_handle) != 0) { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour clear"); + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour fork uninstall"); result = 1; } - metacall_detour = NULL; + detour_fork_handle = NULL; } - detour_destroy(); - metacall_pre_fork_callback = NULL; metacall_post_fork_callback = NULL; diff --git a/source/metacall/source/metacall_link.c b/source/metacall/source/metacall_link.c new file mode 100644 index 000000000..82f0ca851 --- /dev/null +++ b/source/metacall/source/metacall_link.c @@ -0,0 +1,117 @@ +// /* +// * MetaCall Library by Parra Studios +// * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia +// * +// * A library for providing a foreign function interface calls. +// * +// */ + +// /* -- Headers -- */ + +#include +#include + +#include + +#include + +#include + +/* -- Private Variables -- */ + +static detour_handle detour_link_handle = NULL; + +#if defined(WIN32) || defined(_WIN32) || \ + defined(__CYGWIN__) || defined(__CYGWIN32__) || \ + defined(__MINGW32__) || defined(__MINGW64__) + + #include + +void (*metacall_link_func(void))(void) +{ + return (void (*)(void))(&GetProcAddress); +} + +FARPROC metacall_link_hook(HMODULE handle, LPCSTR symbol) +{ + typedef FARPROC (*metacall_link_func_ptr)(HMODULE, LPCSTR); + + metacall_link_func_ptr metacall_link_trampoline = (metacall_link_func_ptr)detour_trampoline(detour_link_handle); + + // TODO: Intercept if any, iterate hash map elements and invoke them + + return metacall_link_trampoline(handle, symbol); +} + +#elif defined(unix) || defined(__unix__) || defined(__unix) || \ + defined(linux) || defined(__linux__) || defined(__linux) || defined(__gnu_linux) || \ + defined(__CYGWIN__) || defined(__CYGWIN32__) || \ + (defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__) + + #include + +void (*metacall_link_func(void))(void) +{ + return (void (*)(void))(&dlsym); +} + +void *metacall_link_hook(void *handle, const char *symbol) +{ + typedef void *(*metacall_link_func_ptr)(void *, const char *); + + metacall_link_func_ptr metacall_link_trampoline = (metacall_link_func_ptr)detour_trampoline(detour_link_handle); + + // TODO: Intercept if any, iterate hash map elements and invoke them + + return metacall_link_trampoline(handle, symbol); +} + +#else + #error "Unknown metacall link platform" +#endif + +/* -- Methods -- */ + +int metacall_link_initialize(void) +{ + detour d = detour_create(metacall_detour()); + + if (detour_link_handle == NULL) + { + detour_link_handle = detour_install(d, (void (*)(void))metacall_link_func(), (void (*)(void))(&metacall_link_hook)); + + if (detour_link_handle == NULL) + { + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour link installation"); + + metacall_link_destroy(); + + return 1; + } + } + + return 0; +} + +int metacall_link_destroy(void) +{ + int result = 0; + + if (detour_link_handle != NULL) + { + detour d = detour_create(metacall_detour()); + + if (detour_uninstall(d, detour_link_handle) != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid detour fork uninstall"); + + result = 1; + } + + detour_link_handle = NULL; + } + + // TODO: Destroy hash map + + return result; +} From d9604dd16296ccd1c050d7f1d3f6df3ce9040760 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 29 Nov 2024 00:55:44 +0100 Subject: [PATCH 07/66] Implemented metacall link table. --- source/dynlink/include/dynlink/dynlink_type.h | 14 +++ .../metacall/include/metacall/metacall_link.h | 33 +++++- source/metacall/source/metacall_fork.c | 14 ++- source/metacall/source/metacall_link.c | 103 ++++++++++++++++-- 4 files changed, 150 insertions(+), 14 deletions(-) diff --git a/source/dynlink/include/dynlink/dynlink_type.h b/source/dynlink/include/dynlink/dynlink_type.h index 7661172e7..5347eb51a 100644 --- a/source/dynlink/include/dynlink/dynlink_type.h +++ b/source/dynlink/include/dynlink/dynlink_type.h @@ -62,6 +62,20 @@ typedef void (*dynlink_symbol_addr)(void); /**< Function pointer referrin \ } while (0) +#define dynlink_symbol_uncast(fn, result) \ + do \ + { \ + union \ + { \ + void *ptr; \ + dynlink_symbol_addr fn; \ + } cast; \ +\ + cast.fn = (fn); \ + (result) = cast.ptr; \ +\ + } while (0) + #ifdef __cplusplus } #endif diff --git a/source/metacall/include/metacall/metacall_link.h b/source/metacall/include/metacall/metacall_link.h index b0665a824..9d5f7d890 100644 --- a/source/metacall/include/metacall/metacall_link.h +++ b/source/metacall/include/metacall/metacall_link.h @@ -40,7 +40,38 @@ extern "C" { */ METACALL_API int metacall_link_initialize(void); -// TODO: Implement dlsym hook function table +/** +* @brief +* Register a function pointer in order to allow function +* interposition when loading a library, if you register a +* function @symbol called 'foo', when you try to dlsym (or the equivalent +* on every platform), you will get the pointer to @fn, even if +* the symbol does not exist in the library, it will work. +* Function interposition is required in order to hook into runtimes +* and dynamically interpose our functions. +* +* @param[in] symbol +* Name of the function to be interposed +* +* @param[in] fn +* Function pointer that will be returned by dlsym (or equivalent) when accessing to @symbol +* +* @return +* Zero if success, different from zero otherwise +*/ +METACALL_API int metacall_link_register(const char *symbol, void (*fn)(void)); + +/** +* @brief +* Remove the hook previously registered +* +* @param[in] symbol +* Name of the function to be removed +* +* @return +* Zero if success, different from zero otherwise +*/ +METACALL_API int metacall_link_unregister(const char *symbol); /** * @brief diff --git a/source/metacall/source/metacall_fork.c b/source/metacall/source/metacall_fork.c index 379a1a61c..6cbe972e6 100644 --- a/source/metacall/source/metacall_fork.c +++ b/source/metacall/source/metacall_fork.c @@ -1,8 +1,20 @@ /* * MetaCall Library by Parra Studios + * A library for providing a foreign function interface calls. + * * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia * - * A library for providing a foreign function interface calls. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * */ diff --git a/source/metacall/source/metacall_link.c b/source/metacall/source/metacall_link.c index 82f0ca851..d1343c52d 100644 --- a/source/metacall/source/metacall_link.c +++ b/source/metacall/source/metacall_link.c @@ -1,26 +1,44 @@ -// /* -// * MetaCall Library by Parra Studios -// * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia -// * -// * A library for providing a foreign function interface calls. -// * -// */ - -// /* -- Headers -- */ +/* + * MetaCall Library by Parra Studios + * A library for providing a foreign function interface calls. + * + * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/* -- Headers -- */ #include #include #include +#include + #include +#include + #include /* -- Private Variables -- */ static detour_handle detour_link_handle = NULL; +static set metacall_link_table = NULL; + #if defined(WIN32) || defined(_WIN32) || \ defined(__CYGWIN__) || defined(__CYGWIN32__) || \ defined(__MINGW32__) || defined(__MINGW64__) @@ -38,7 +56,17 @@ FARPROC metacall_link_hook(HMODULE handle, LPCSTR symbol) metacall_link_func_ptr metacall_link_trampoline = (metacall_link_func_ptr)detour_trampoline(detour_link_handle); - // TODO: Intercept if any, iterate hash map elements and invoke them + /* Intercept if any */ + void *ptr = set_get(metacall_link_table, (set_key)symbol); + + if (ptr != NULL) + { + dynlink_symbol_addr addr; + + dynlink_symbol_cast(void *, ptr, addr); + + return (FARPROC)addr; + } return metacall_link_trampoline(handle, symbol); } @@ -61,7 +89,15 @@ void *metacall_link_hook(void *handle, const char *symbol) metacall_link_func_ptr metacall_link_trampoline = (metacall_link_func_ptr)detour_trampoline(detour_link_handle); - // TODO: Intercept if any, iterate hash map elements and invoke them + /* Intercept function if any */ + void *ptr = set_get(metacall_link_table, (set_key)symbol); + + log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall detour link interception: %s -> %p", symbol, ptr); + + if (ptr != NULL) + { + return ptr; + } return metacall_link_trampoline(handle, symbol); } @@ -90,9 +126,47 @@ int metacall_link_initialize(void) } } + if (metacall_link_table == NULL) + { + metacall_link_table = set_create(&hash_callback_str, &comparable_callback_str); + + if (metacall_link_table == NULL) + { + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall failed to create link table"); + + metacall_link_destroy(); + + return 1; + } + } + return 0; } +int metacall_link_register(const char *symbol, void (*fn)(void)) +{ + void *ptr; + + if (metacall_link_table == NULL) + { + return 1; + } + + dynlink_symbol_uncast(fn, ptr); + + return set_insert(metacall_link_table, (set_key)symbol, ptr); +} + +int metacall_link_unregister(const char *symbol) +{ + if (metacall_link_table == NULL) + { + return 1; + } + + return (set_remove(metacall_link_table, (set_key)symbol) == NULL); +} + int metacall_link_destroy(void) { int result = 0; @@ -111,7 +185,12 @@ int metacall_link_destroy(void) detour_link_handle = NULL; } - // TODO: Destroy hash map + if (metacall_link_table != NULL) + { + set_destroy(metacall_link_table); + + metacall_link_table = NULL; + } return result; } From 83de5532b76c7b213567964b18f5ed4df329b035 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 4 Dec 2024 02:08:10 +0100 Subject: [PATCH 08/66] Initialization working properly on NodeJS. --- source/loader/include/loader/loader.h | 2 + source/loader/include/loader/loader_impl.h | 2 + source/loader/source/loader.c | 12 + source/loader/source/loader_impl.c | 2 - source/loaders/node_loader/CMakeLists.txt | 2 +- .../node_loader/bootstrap/lib/bootstrap.js | 20 +- .../include/node_loader/node_loader_impl.h | 2 + .../node_loader/node_loader_trampoline.h | 2 + .../node_loader/source/node_loader_impl.cpp | 468 +++++++++--------- .../node_loader/source/node_loader_port.cpp | 19 +- .../source/node_loader_trampoline.cpp | 28 ++ source/metacall/source/metacall.c | 11 + source/ports/node_port/index.js | 15 +- 13 files changed, 340 insertions(+), 245 deletions(-) diff --git a/source/loader/include/loader/loader.h b/source/loader/include/loader/loader.h index 3c31ba98d..a108b3c5c 100644 --- a/source/loader/include/loader/loader.h +++ b/source/loader/include/loader/loader.h @@ -51,6 +51,8 @@ LOADER_API void loader_initialization_register(loader_impl impl); LOADER_API int loader_initialize(void); +LOADER_NO_EXPORT int loader_initialize_host(const loader_tag tag); + LOADER_API int loader_is_initialized(const loader_tag tag); LOADER_API int loader_register(const char *name, loader_register_invoke invoke, function *func, type_id return_type, size_t arg_size, type_id args_type_id[]); diff --git a/source/loader/include/loader/loader_impl.h b/source/loader/include/loader/loader_impl.h index 8eea205e2..726cdf2ca 100644 --- a/source/loader/include/loader/loader_impl.h +++ b/source/loader/include/loader/loader_impl.h @@ -35,6 +35,8 @@ extern "C" { /* -- Methods -- */ +LOADER_NO_EXPORT int loader_impl_initialize(plugin_manager manager, plugin p, loader_impl impl); + LOADER_API int loader_impl_is_initialized(loader_impl impl); LOADER_API loader_impl loader_impl_create(const loader_tag tag); diff --git a/source/loader/source/loader.c b/source/loader/source/loader.c index 13b136445..8fc490118 100644 --- a/source/loader/source/loader.c +++ b/source/loader/source/loader.c @@ -201,6 +201,18 @@ void loader_initialization_register_plugin(plugin p) } } +int loader_initialize_host(const loader_tag tag) +{ + plugin p = plugin_manager_get(&loader_manager, tag); + + if (p == NULL) + { + return 1; + } + + return loader_impl_initialize(&loader_manager, p, plugin_impl_type(p, loader_impl)); +} + int loader_is_initialized(const loader_tag tag) { plugin p = plugin_manager_get(&loader_manager, tag); diff --git a/source/loader/source/loader_impl.c b/source/loader/source/loader_impl.c index 80c58db32..7d9bdbf4c 100644 --- a/source/loader/source/loader_impl.c +++ b/source/loader/source/loader_impl.c @@ -123,8 +123,6 @@ static configuration loader_impl_initialize_configuration(plugin p); static int loader_impl_initialize_registered(plugin_manager manager, plugin p); -static int loader_impl_initialize(plugin_manager manager, plugin p, loader_impl impl); - static loader_handle_impl loader_impl_load_handle(loader_impl impl, loader_impl_interface iface, loader_handle module, const char *path, size_t size); static int loader_impl_handle_init(loader_impl impl, const char *path, loader_handle_impl handle_impl, void **handle_ptr, int populated); diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index a9bf13c67..70108f53e 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -158,7 +158,7 @@ target_link_libraries(${target} ${META_PROJECT_NAME}::metacall # MetaCall library # TODO: Implement delayed load - ${NodeJS_LIBRARY} # NodeJS library + # ${NodeJS_LIBRARY} # NodeJS library PUBLIC ${DEFAULT_LIBRARIES} diff --git a/source/loaders/node_loader/bootstrap/lib/bootstrap.js b/source/loaders/node_loader/bootstrap/lib/bootstrap.js index 5582ab48e..4f2c5b766 100644 --- a/source/loaders/node_loader/bootstrap/lib/bootstrap.js +++ b/source/loaders/node_loader/bootstrap/lib/bootstrap.js @@ -408,14 +408,20 @@ function node_loader_trampoline_await_future(trampoline) { }; } -module.exports = ((impl, ptr) => { +const startup = (impl, ptr, trampoline_exports) => { try { if (typeof impl === 'undefined' || typeof ptr === 'undefined') { - throw new Error('Process arguments (process.argv[2], process.argv[3]) not defined.'); + throw new Error('Bootstrap startup arguments impl or ptr are not defined.'); } // Get trampoline from list of linked bindings - const trampoline = process._linkedBinding('node_loader_trampoline_module'); + const trampoline = (() => { + if (trampoline_exports) { + return trampoline_exports; + } + + return process._linkedBinding('node_loader_trampoline_module'); + })(); const node_loader_ptr = trampoline.register(impl, ptr, { 'initialize': node_loader_trampoline_initialize, @@ -433,4 +439,12 @@ module.exports = ((impl, ptr) => { } catch (ex) { console.log('Exception in bootstrap.js trampoline initialization:', ex); } +}; + +module.exports = ((impl, ptr) => { + if (impl === undefined || ptr === undefined) { + return startup; + } else { + return startup(impl, ptr); + } })(process.argv[2], process.argv[3]); diff --git a/source/loaders/node_loader/include/node_loader/node_loader_impl.h b/source/loaders/node_loader/include/node_loader/node_loader_impl.h index 6aa1f3448..b41893a62 100644 --- a/source/loaders/node_loader/include/node_loader/node_loader_impl.h +++ b/source/loaders/node_loader/include/node_loader/node_loader_impl.h @@ -69,6 +69,8 @@ NODE_LOADER_NO_EXPORT void node_loader_impl_print_handles(loader_impl_node node_ NODE_LOADER_NO_EXPORT int64_t node_loader_impl_user_async_handles_count(loader_impl_node node_impl); +NODE_LOADER_NO_EXPORT napi_value node_loader_impl_register_bootstrap_startup(loader_impl_node node_impl, napi_env env); + #ifdef __cplusplus } #endif diff --git a/source/loaders/node_loader/include/node_loader/node_loader_trampoline.h b/source/loaders/node_loader/include/node_loader/node_loader_trampoline.h index 228d6f5c6..84ea34ccf 100644 --- a/source/loaders/node_loader/include/node_loader/node_loader_trampoline.h +++ b/source/loaders/node_loader/include/node_loader/node_loader_trampoline.h @@ -33,6 +33,8 @@ typedef void *(*node_loader_trampoline_register_ptr)(void *, void *, void *); NODE_LOADER_NO_EXPORT napi_value node_loader_trampoline_initialize(napi_env env, napi_value exports); +NODE_LOADER_NO_EXPORT napi_value node_loader_trampoline_initialize_object(napi_env env); + #ifdef __cplusplus } #endif diff --git a/source/loaders/node_loader/source/node_loader_impl.cpp b/source/loaders/node_loader/source/node_loader_impl.cpp index 720c7b1a2..053754289 100644 --- a/source/loaders/node_loader/source/node_loader_impl.cpp +++ b/source/loaders/node_loader/source/node_loader_impl.cpp @@ -77,9 +77,6 @@ extern char **environ; #include #include -#include -#include -#include #include #include @@ -553,6 +550,118 @@ struct loader_impl_async_destroy_safe_type node_impl(node_impl), has_finished(false) {} }; +static void *node_loader_impl_register(void *node_impl_ptr, void *env_ptr, void *function_table_object_ptr); + +typedef struct node_loader_impl_startup_args_type +{ + /* Executable path */ + portability_executable_path_str exe_path_str = { 0 }; + portability_executable_path_length length = 0; + size_t exe_path_str_size = 0, exe_path_str_offset = 0; + + /* Bootstrap path */ + loader_path bootstrap_path_str = { 0 }; + size_t bootstrap_path_str_size = 0; + + /* The node_impl pointer */ + char *node_impl_ptr_str = nullptr; + size_t node_impl_ptr_str_size = 0; + + /* The register function pointer */ + char *register_ptr_str = nullptr; + size_t register_ptr_str_size = 0; + + node_loader_impl_startup_args_type() {} + + ~node_loader_impl_startup_args_type() + { + if (node_impl_ptr_str != nullptr) + { + delete[] node_impl_ptr_str; + } + + if (register_ptr_str != nullptr) + { + delete[] register_ptr_str; + } + } + + int initialize(loader_impl_node node_impl, configuration config) + { + /* Get the executable */ + if (portability_executable_path(exe_path_str, &length) != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "Node loader failed to retrieve the executable path (%s)", exe_path_str); + return 1; + } + + for (size_t iterator = 0; iterator <= (size_t)length; ++iterator) + { +#if defined(WIN32) || defined(_WIN32) + if (exe_path_str[iterator] == '\\') +#else + if (exe_path_str[iterator] == '/') +#endif + { + exe_path_str_offset = iterator + 1; + } + } + + exe_path_str_size = (size_t)length - exe_path_str_offset + 1; + + /* Get the bootstrap.js path */ + static const char bootstrap_file_str[] = "bootstrap.js"; + + if (node_loader_impl_bootstrap_path(bootstrap_file_str, sizeof(bootstrap_file_str) - 1, config, bootstrap_path_str, &bootstrap_path_str_size) != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "LOADER_LIBRARY_PATH environment variable or loader_library_path field in configuration is not defined, bootstrap.js cannot be found"); + return 1; + } + + /* Get node impl pointer */ + ssize_t node_impl_ptr_length = snprintf(NULL, 0, "%p", (void *)node_impl); + + if (node_impl_ptr_length <= 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "Invalid node impl pointer length in NodeJS thread"); + return 1; + } + + node_impl_ptr_str_size = static_cast(node_impl_ptr_length + 1); + node_impl_ptr_str = new char[node_impl_ptr_str_size]; + + if (node_impl_ptr_str == nullptr) + { + log_write("metacall", LOG_LEVEL_ERROR, "Invalid node impl pointer initialization in NodeJS thread"); + return 1; + } + + snprintf(node_impl_ptr_str, node_impl_ptr_str_size, "%p", (void *)node_impl); + + /* Get register pointer */ + ssize_t register_ptr_length = snprintf(NULL, 0, "%p", (void *)&node_loader_impl_register); + + if (register_ptr_length <= 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "Invalid register pointer length in NodeJS thread"); + return 1; + } + + register_ptr_str_size = static_cast(register_ptr_length + 1); + register_ptr_str = new char[register_ptr_str_size]; + + if (register_ptr_str == nullptr) + { + log_write("metacall", LOG_LEVEL_ERROR, "Invalid register pointer initialization in NodeJS thread"); + return 1; + } + + snprintf(register_ptr_str, register_ptr_str_size, "%p", (void *)&node_loader_impl_register); + + return 0; + } +} * node_loader_impl_startup_args; + struct loader_impl_node_type { /* TODO: The current implementation may not support multi-isolate environments. We should test it. */ @@ -588,8 +697,8 @@ struct loader_impl_node_type uv_thread_t thread_log_id; #endif + node_loader_impl_startup_args_type thread_data; int result; - const char *error_message; /* TODO: This implementation won't work for multi-isolate environments. We should test it. */ std::thread::id js_thread_id; @@ -688,13 +797,6 @@ typedef struct loader_impl_async_func_await_trampoline_type } * loader_impl_async_func_await_trampoline; -typedef struct loader_impl_thread_type -{ - loader_impl_node node_impl; - configuration config; - -} * loader_impl_thread; - typedef struct loader_impl_napi_to_value_callback_closure_type { value func; @@ -702,6 +804,23 @@ typedef struct loader_impl_napi_to_value_callback_closure_type } * loader_impl_napi_to_value_callback_closure; +class loader_impl_napi_constructor +{ +public: + loader_impl_napi_constructor() + { + if (metacall_link_register("napi_register_module_v1", (void (*)(void))(&node_loader_port_initialize)) != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "Node loader failed register the link hook"); + } + } + + ~loader_impl_napi_constructor() {} +}; + +/* Initializer of napi_register_module_v1 */ +static loader_impl_napi_constructor loader_impl_napi_ctor; + /* Type conversion */ static napi_value node_loader_impl_napi_to_value_callback(napi_env env, napi_callback_info info); @@ -757,8 +876,6 @@ static void node_loader_impl_destroy_safe(napi_env env, loader_impl_async_destro static char *node_loader_impl_get_property_as_char(napi_env env, napi_value obj, const char *prop); /* Loader */ -static void *node_loader_impl_register(void *node_impl_ptr, void *env_ptr, void *function_table_object_ptr); - static void node_loader_impl_thread(void *data); #ifdef __ANDROID__ @@ -3590,185 +3707,30 @@ void *node_loader_impl_register(void *node_impl_ptr, void *env_ptr, void *functi void node_loader_impl_thread(void *data) { - loader_impl_thread thread_data = static_cast(data); - loader_impl_node node_impl = thread_data->node_impl; - configuration config = thread_data->config; + loader_impl_node node_impl = static_cast(data); + node_loader_impl_startup_args args = &node_impl->thread_data; /* Lock node implementation mutex */ uv_mutex_lock(&node_impl->mutex); - /* TODO: Reimplement from here to ... */ - portability_executable_path_str exe_path_str = { 0 }; - portability_executable_path_length length = 0; - size_t exe_path_str_size = 0, exe_path_str_offset = 0; - - if (portability_executable_path(exe_path_str, &length) != 0) - { - /* Report error (TODO: Implement it with thread safe logs) */ - node_impl->error_message = "Node loader failed to retrieve the executable path"; - - /* TODO: Make logs thread safe */ - /* log_write("metacall", LOG_LEVEL_ERROR, "Node loader failed to retrieve the executable path (%s)", exe_path_str); */ - - /* Signal start condition */ - uv_cond_signal(&node_impl->cond); - - /* Unlock node implementation mutex */ - uv_mutex_unlock(&node_impl->mutex); - - return; - } - - for (size_t iterator = 0; iterator <= (size_t)length; ++iterator) - { -#if defined(WIN32) || defined(_WIN32) - if (exe_path_str[iterator] == '\\') -#else - if (exe_path_str[iterator] == '/') -#endif - { - exe_path_str_offset = iterator + 1; - } - } - - exe_path_str_size = (size_t)length - exe_path_str_offset + 1; - - /* Get the boostrap path */ - static const char bootstrap_file_str[] = "bootstrap.js"; - loader_path bootstrap_path_str = { 0 }; - size_t bootstrap_path_str_size = 0; - - if (node_loader_impl_bootstrap_path(bootstrap_file_str, sizeof(bootstrap_file_str) - 1, config, bootstrap_path_str, &bootstrap_path_str_size) != 0) - { - /* Report error (TODO: Implement it with thread safe logs) */ - node_impl->error_message = "LOADER_LIBRARY_PATH environment variable or loader_library_path field in configuration is not defined, bootstrap.js cannot be found"; - - /* Signal start condition */ - uv_cond_signal(&node_impl->cond); - - /* Unlock node implementation mutex */ - uv_mutex_unlock(&node_impl->mutex); - - return; - } - - /* Get node impl pointer */ - char *node_impl_ptr_str; - size_t node_impl_ptr_str_size; - - ssize_t node_impl_ptr_length = snprintf(NULL, 0, "%p", (void *)node_impl); - - if (node_impl_ptr_length <= 0) - { - /* Report error (TODO: Implement it with thread safe logs) */ - node_impl->error_message = "Invalid node impl pointer length in NodeJS thread"; - - /* Signal start condition */ - uv_cond_signal(&node_impl->cond); - - /* Unlock node implementation mutex */ - uv_mutex_unlock(&node_impl->mutex); - - return; - } - - node_impl_ptr_str_size = static_cast(node_impl_ptr_length + 1); - node_impl_ptr_str = new char[node_impl_ptr_str_size]; - - if (node_impl_ptr_str == nullptr) - { - /* Report error (TODO: Implement it with thread safe logs) */ - node_impl->error_message = "Invalid node impl pointer initialization in NodeJS thread"; - - /* Signal start condition */ - uv_cond_signal(&node_impl->cond); - - /* Unlock node implementation mutex */ - uv_mutex_unlock(&node_impl->mutex); - - return; - } - - snprintf(node_impl_ptr_str, node_impl_ptr_str_size, "%p", (void *)node_impl); - - /* Get register pointer */ - char *register_ptr_str; - size_t register_ptr_str_size; - ssize_t register_ptr_length = snprintf(NULL, 0, "%p", (void *)&node_loader_impl_register); - - if (register_ptr_length <= 0) - { - /* Report error (TODO: Implement it with thread safe logs) */ - node_impl->error_message = "Invalid register pointer length in NodeJS thread"; - - /* Signal start condition */ - uv_cond_signal(&node_impl->cond); - - /* Unlock node implementation mutex */ - uv_mutex_unlock(&node_impl->mutex); - - return; - } - - register_ptr_str_size = static_cast(register_ptr_length + 1); - register_ptr_str = new char[register_ptr_str_size]; - - if (register_ptr_str == nullptr) - { - delete[] node_impl_ptr_str; - - /* Report error (TODO: Implement it with thread safe logs) */ - node_impl->error_message = "Invalid register pointer initialization in NodeJS thread"; - - /* Signal start condition */ - uv_cond_signal(&node_impl->cond); - - /* Unlock node implementation mutex */ - uv_mutex_unlock(&node_impl->mutex); - - return; - } - - snprintf(register_ptr_str, register_ptr_str_size, "%p", (void *)&node_loader_impl_register); - /* Define argv_str contigously allocated with: executable name, bootstrap file, node impl pointer and register pointer */ - size_t argv_str_size = exe_path_str_size + bootstrap_path_str_size + node_impl_ptr_str_size + register_ptr_str_size; + size_t argv_str_size = args->exe_path_str_size + args->bootstrap_path_str_size + args->node_impl_ptr_str_size + args->register_ptr_str_size; char *argv_str = new char[argv_str_size]; - if (argv_str == nullptr) - { - delete[] node_impl_ptr_str; - delete[] register_ptr_str; - - /* Report error (TODO: Implement it with thread safe logs) */ - node_impl->error_message = "Invalid argv initialization in NodeJS thread"; - - /* Signal start condition */ - uv_cond_signal(&node_impl->cond); - - /* Unlock node implementation mutex */ - uv_mutex_unlock(&node_impl->mutex); - - return; - } - /* Initialize the argv string memory */ memset(argv_str, 0, sizeof(char) * argv_str_size); - memcpy(&argv_str[0], &exe_path_str[exe_path_str_offset], exe_path_str_size); - memcpy(&argv_str[exe_path_str_size], bootstrap_path_str, bootstrap_path_str_size); - memcpy(&argv_str[exe_path_str_size + bootstrap_path_str_size], node_impl_ptr_str, node_impl_ptr_str_size); - memcpy(&argv_str[exe_path_str_size + bootstrap_path_str_size + node_impl_ptr_str_size], register_ptr_str, register_ptr_str_size); - - delete[] node_impl_ptr_str; - delete[] register_ptr_str; + memcpy(&argv_str[0], &args->exe_path_str[args->exe_path_str_offset], args->exe_path_str_size); + memcpy(&argv_str[args->exe_path_str_size], args->bootstrap_path_str, args->bootstrap_path_str_size); + memcpy(&argv_str[args->exe_path_str_size + args->bootstrap_path_str_size], args->node_impl_ptr_str, args->node_impl_ptr_str_size); + memcpy(&argv_str[args->exe_path_str_size + args->bootstrap_path_str_size + args->node_impl_ptr_str_size], args->register_ptr_str, args->register_ptr_str_size); /* Define argv */ char *argv[] = { &argv_str[0], - &argv_str[exe_path_str_size], - &argv_str[exe_path_str_size + bootstrap_path_str_size], - &argv_str[exe_path_str_size + bootstrap_path_str_size + node_impl_ptr_str_size], + &argv_str[args->exe_path_str_size], + &argv_str[args->exe_path_str_size + args->bootstrap_path_str_size], + &argv_str[args->exe_path_str_size + args->bootstrap_path_str_size + args->node_impl_ptr_str_size], NULL }; @@ -3817,8 +3779,6 @@ void node_loader_impl_thread(void *data) /* Unlock node implementation mutex */ uv_mutex_unlock(&node_impl->mutex); - /* Register bindings for versions older than 18 */ - /* Start NodeJS runtime */ int result = node::Start(argc, reinterpret_cast(argv)); @@ -3915,7 +3875,6 @@ loader_impl_data node_loader_impl_initialize(loader_impl impl, configuration con /* Initialize execution result */ node_impl->result = 1; - node_impl->error_message = NULL; /* Initialize the reference to the loader so we can use it on the destruction */ node_impl->impl = impl; @@ -3936,15 +3895,19 @@ loader_impl_data node_loader_impl_initialize(loader_impl impl, configuration con } #endif - struct loader_impl_thread_type thread_data = { - node_impl, - config - }; + if (node_impl->thread_data.initialize(node_impl, config) != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "Invalid startup arguments creation"); + + delete node_impl; + + return NULL; + } if (loader_impl_get_option_host(impl) == 0) { /* Create NodeJS thread */ - if (uv_thread_create(&node_impl->thread, node_loader_impl_thread, &thread_data) != 0) + if (uv_thread_create(&node_impl->thread, node_loader_impl_thread, node_impl) != 0) { log_write("metacall", LOG_LEVEL_ERROR, "Invalid NodeJS Thread creation"); @@ -3960,50 +3923,45 @@ loader_impl_data node_loader_impl_initialize(loader_impl impl, configuration con uv_cond_wait(&node_impl->cond, &node_impl->mutex); - if (node_impl->error_message != NULL) - { - uv_mutex_unlock(&node_impl->mutex); - - /* TODO: Remove this when implementing thread safe */ - log_write("metacall", LOG_LEVEL_ERROR, node_impl->error_message); - - return NULL; - } - uv_mutex_unlock(&node_impl->mutex); - } - - /* Call initialize function with thread safe */ - { - loader_impl_async_initialize_safe_type initialize_safe(node_impl, value_to_string(configuration_value(config, "loader_library_path"))); - int result = 1; - /* Check if we are in the JavaScript thread */ - if (node_impl->js_thread_id == std::this_thread::get_id()) + /* Call initialize function with thread safe (only when not using host) */ { - /* We are already in the V8 thread, we can call safely */ - node_loader_impl_initialize_safe(node_impl->env, &initialize_safe); + loader_impl_async_initialize_safe_type initialize_safe(node_impl, value_to_string(configuration_value(config, "loader_library_path"))); + int result = 1; - /* Set up return of the function call */ - result = initialize_safe.result; - } - else - { - /* Submit the task to the async queue */ - loader_impl_threadsafe_invoke_type invoke(node_impl->threadsafe_initialize, initialize_safe); + /* Check if we are in the JavaScript thread */ + if (node_impl->js_thread_id == std::this_thread::get_id()) + { + /* We are already in the V8 thread, we can call safely */ + node_loader_impl_initialize_safe(node_impl->env, &initialize_safe); - /* Set up return of the function call */ - result = initialize_safe.result; - } + /* Set up return of the function call */ + result = initialize_safe.result; + } + else + { + /* Submit the task to the async queue */ + loader_impl_threadsafe_invoke_type invoke(node_impl->threadsafe_initialize, initialize_safe); - if (result != 0) - { - /* TODO: Implement better error message */ - log_write("metacall", LOG_LEVEL_ERROR, "Call to initialization function node_loader_impl_async_initialize_safe failed"); + /* Set up return of the function call */ + result = initialize_safe.result; + } - /* TODO: Handle properly the error */ + if (result != 0) + { + /* TODO: Implement better error message */ + log_write("metacall", LOG_LEVEL_ERROR, "Call to initialization function node_loader_impl_async_initialize_safe failed"); + + /* TODO: Handle properly the error */ + } } } + else + { + // TODO: Set this to NULL and if in execution_path is null, delay the execution paths.. + node_impl->thread_loop = uv_default_loop(); + } /* Register initialization */ loader_initialization_register(impl); @@ -4011,29 +3969,65 @@ loader_impl_data node_loader_impl_initialize(loader_impl impl, configuration con return node_impl; } -int node_loader_impl_execution_path(loader_impl impl, const loader_path path) +napi_value node_loader_impl_register_bootstrap_startup(loader_impl_node node_impl, napi_env env) { - loader_impl_node node_impl = static_cast(loader_impl_get(impl)); + node_loader_impl_startup_args args = &node_impl->thread_data; + napi_value argv[4], v; + napi_status status; - if (node_impl == nullptr) - { - return 1; - } + status = napi_create_array_with_length(env, 4, &v); + node_loader_impl_exception(env, status); - loader_impl_async_execution_path_safe_type execution_path_safe(node_impl, static_cast(path)); + /* Convert bootstrap.js path to N-API value */ + status = napi_create_string_utf8(env, args->bootstrap_path_str, args->bootstrap_path_str_size - 1, &argv[0]); + node_loader_impl_exception(env, status); - /* Check if we are in the JavaScript thread */ - if (node_impl->js_thread_id == std::this_thread::get_id()) - { - /* We are already in the V8 thread, we can call safely */ - node_loader_impl_execution_path_safe(node_impl->env, &execution_path_safe); - } - else + /* Convert node impl to N-API value */ + status = napi_create_string_utf8(env, args->node_impl_ptr_str, args->node_impl_ptr_str_size - 1, &argv[1]); + node_loader_impl_exception(env, status); + + /* Convert register to N-API value */ + status = napi_create_string_utf8(env, args->register_ptr_str, args->register_ptr_str_size - 1, &argv[2]); + node_loader_impl_exception(env, status); + + /* Create trampoline exports */ + argv[3] = node_loader_trampoline_initialize_object(env); + + /* Set the values */ + for (size_t iterator = 0; iterator < 4; ++iterator) { - /* Submit the task to the async queue */ - loader_impl_threadsafe_invoke_type invoke(node_impl->threadsafe_execution_path, execution_path_safe); + status = napi_set_element(env, v, iterator, argv[iterator]); + node_loader_impl_exception(env, status); } + return v; +} + +int node_loader_impl_execution_path(loader_impl impl, const loader_path path) +{ + // TODO: + + // loader_impl_node node_impl = static_cast(loader_impl_get(impl)); + + // if (node_impl == nullptr) + // { + // return 1; + // } + + // loader_impl_async_execution_path_safe_type execution_path_safe(node_impl, static_cast(path)); + + // /* Check if we are in the JavaScript thread */ + // if (node_impl->js_thread_id == std::this_thread::get_id()) + // { + // /* We are already in the V8 thread, we can call safely */ + // node_loader_impl_execution_path_safe(node_impl->env, &execution_path_safe); + // } + // else + // { + // /* Submit the task to the async queue */ + // loader_impl_threadsafe_invoke_type invoke(node_impl->threadsafe_execution_path, execution_path_safe); + // } + return 0; } diff --git a/source/loaders/node_loader/source/node_loader_port.cpp b/source/loaders/node_loader/source/node_loader_port.cpp index 8261f6bce..2238c0ab3 100644 --- a/source/loaders/node_loader/source/node_loader_port.cpp +++ b/source/loaders/node_loader/source/node_loader_port.cpp @@ -799,6 +799,16 @@ napi_value node_loader_port_metacall_logs(napi_env env, napi_callback_info) return nullptr; } +napi_value node_loader_port_register_bootstrap_startup(napi_env env, napi_callback_info) +{ + /* Obtain NodeJS loader implementation */ + loader_impl impl = loader_get_impl(node_loader_tag); + loader_impl_node node_impl = static_cast(loader_impl_get(impl)); + + /* Return all the values required for the bootstrap startup */ + return node_loader_impl_register_bootstrap_startup(node_impl, env); +} + /* TODO: Review documentation */ // This functions sets the necessary js functions that could be called in NodeJs void node_loader_port_exports(napi_env env, napi_value exports) @@ -823,7 +833,8 @@ void node_loader_port_exports(napi_env env, napi_value exports) x(metacall_load_from_configuration); \ x(metacall_load_from_configuration_export); \ x(metacall_inspect); \ - x(metacall_logs); + x(metacall_logs); \ + x(register_bootstrap_startup); /* Declare all the functions */ NODE_LOADER_PORT_DECL_X_MACRO(NODE_LOADER_PORT_DECL_FUNC) @@ -838,5 +849,11 @@ napi_value node_loader_port_initialize(napi_env env, napi_value exports) { node_loader_port_exports(env, exports); + /* Unregister NAPI Hook */ + if (metacall_link_unregister("napi_register_module_v1") != 0) + { + // TODO: Handle error + } + return exports; } diff --git a/source/loaders/node_loader/source/node_loader_trampoline.cpp b/source/loaders/node_loader/source/node_loader_trampoline.cpp index 184fbbcda..6314d2d30 100644 --- a/source/loaders/node_loader/source/node_loader_trampoline.cpp +++ b/source/loaders/node_loader/source/node_loader_trampoline.cpp @@ -427,3 +427,31 @@ napi_value node_loader_trampoline_initialize(napi_env env, napi_value exports) return exports; } + +#define NODE_LOADER_TRAMPOLINE_DECLARE_OBJ_METHOD(name, func) \ + do \ + { \ + napi_value func_value; \ + status = napi_create_function(env, name, NAPI_AUTO_LENGTH, func, nullptr, &func_value); \ + node_loader_impl_exception(env, status); \ + napi_set_named_property(env, obj, name, func_value); \ + node_loader_impl_exception(env, status); \ + } while (0) + +napi_value node_loader_trampoline_initialize_object(napi_env env) +{ + napi_value obj; + napi_status status; + + status = napi_create_object(env, &obj); + node_loader_impl_exception(env, status); + + NODE_LOADER_TRAMPOLINE_DECLARE_OBJ_METHOD("register", node_loader_trampoline_register); + NODE_LOADER_TRAMPOLINE_DECLARE_OBJ_METHOD("resolve", node_loader_trampoline_resolve); + NODE_LOADER_TRAMPOLINE_DECLARE_OBJ_METHOD("reject", node_loader_trampoline_reject); + NODE_LOADER_TRAMPOLINE_DECLARE_OBJ_METHOD("destroy", node_loader_trampoline_destroy); + NODE_LOADER_TRAMPOLINE_DECLARE_OBJ_METHOD("print", node_loader_trampoline_print); + NODE_LOADER_TRAMPOLINE_DECLARE_OBJ_METHOD("active_handles", node_loader_trampoline_active_handles); + + return obj; +} diff --git a/source/metacall/source/metacall.c b/source/metacall/source/metacall.c index 02ab3deaa..d7d19f815 100644 --- a/source/metacall/source/metacall.c +++ b/source/metacall/source/metacall.c @@ -350,11 +350,22 @@ int metacall_initialize_ex(struct metacall_initialize_configuration_type initial if (impl == NULL) { + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall failed to find '%s_loader'", initialize_config[index].tag); return 1; } loader_set_options(initialize_config[index].tag, initialize_config[index].options); + /* If we are initializing a loader as a host, we must initialize it */ + if (loader_get_option_host(initialize_config[index].tag)) + { + if (loader_initialize_host(initialize_config[index].tag) != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall failed to initialize '%s_loader' as host", initialize_config[index].tag); + return 1; + } + } + ++index; } diff --git a/source/ports/node_port/index.js b/source/ports/node_port/index.js index 0120fbf61..db45810f2 100644 --- a/source/ports/node_port/index.js +++ b/source/ports/node_port/index.js @@ -133,8 +133,21 @@ const addon = (() => { process.dlopen(m, library, constants.dlopen.RTLD_GLOBAL | constants.dlopen.RTLD_NOW); - // TODO: What to do with m? should we use process._linkedBinding instead, no? + /* Save argv */ + const argv = process.argv; + process.argv = []; + /* Pass the require function in order to import bootstrap.js and register it */ + const args = m.exports.register_bootstrap_startup(); + + const bootstrap = require(args[0]); + + bootstrap(args[1], args[2], args[3]); + + /* Restore argv */ + process.argv = argv; + + return m.exports; }).catch(err => { console.log(err); process.exit(1); From 7779200ec041e19e334a6ed6f0d4561b41f8985f Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 4 Dec 2024 19:59:03 +0100 Subject: [PATCH 09/66] Add delayed execution paths in NodeJS. --- .../node_loader/source/node_loader_impl.cpp | 81 +++++++++++++------ .../node_loader/source/node_loader_port.cpp | 3 + 2 files changed, 59 insertions(+), 25 deletions(-) diff --git a/source/loaders/node_loader/source/node_loader_impl.cpp b/source/loaders/node_loader/source/node_loader_impl.cpp index 053754289..33a0ea036 100644 --- a/source/loaders/node_loader/source/node_loader_impl.cpp +++ b/source/loaders/node_loader/source/node_loader_impl.cpp @@ -684,6 +684,7 @@ struct loader_impl_node_type uv_thread_t thread; uv_loop_t *thread_loop; + std::vector *delayed_execution_paths; uv_mutex_t mutex; uv_cond_t cond; @@ -3691,6 +3692,24 @@ void *node_loader_impl_register(void *node_impl_ptr, void *env_ptr, void *functi get_module_handle_a_ptr = (HMODULE(*)(_In_opt_ LPCSTR))node_loader_hook_import_address_table("kernel32.dll", "GetModuleHandleA", &get_module_handle_a_hook); #endif + /* On host mode, register delayed paths */ + if (node_impl->delayed_execution_paths != nullptr) + { + std::vector *paths = node_impl->delayed_execution_paths; + + node_impl->delayed_execution_paths = nullptr; + + for (const std::string &path : *paths) + { + if (node_loader_impl_execution_path(node_impl->impl, path.c_str()) != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "Failed to register a delayed execution path: %s", path.c_str()); + } + } + + delete paths; + } + /* Close scope */ status = napi_close_handle_scope(env, handle_scope); @@ -3736,8 +3755,7 @@ void node_loader_impl_thread(void *data) int argc = 4; - /* TODO: ... reimplement until here */ - + /* Initialize current thread event loop */ node_impl->thread_loop = uv_default_loop(); #if defined(__POSIX__) @@ -3956,11 +3974,17 @@ loader_impl_data node_loader_impl_initialize(loader_impl impl, configuration con /* TODO: Handle properly the error */ } } + + /* Initialize delayed execution paths to null, they are only used in host mode */ + node_impl->delayed_execution_paths = nullptr; } else { - // TODO: Set this to NULL and if in execution_path is null, delay the execution paths.. + /* Initialize current thread event loop */ node_impl->thread_loop = uv_default_loop(); + + /* Initialize delayed execution paths for register them once it has been initialized */ + node_impl->delayed_execution_paths = new std::vector(); } /* Register initialization */ @@ -4005,28 +4029,35 @@ napi_value node_loader_impl_register_bootstrap_startup(loader_impl_node node_imp int node_loader_impl_execution_path(loader_impl impl, const loader_path path) { - // TODO: - - // loader_impl_node node_impl = static_cast(loader_impl_get(impl)); - - // if (node_impl == nullptr) - // { - // return 1; - // } - - // loader_impl_async_execution_path_safe_type execution_path_safe(node_impl, static_cast(path)); - - // /* Check if we are in the JavaScript thread */ - // if (node_impl->js_thread_id == std::this_thread::get_id()) - // { - // /* We are already in the V8 thread, we can call safely */ - // node_loader_impl_execution_path_safe(node_impl->env, &execution_path_safe); - // } - // else - // { - // /* Submit the task to the async queue */ - // loader_impl_threadsafe_invoke_type invoke(node_impl->threadsafe_execution_path, execution_path_safe); - // } + loader_impl_node node_impl = static_cast(loader_impl_get(impl)); + + if (node_impl == nullptr) + { + return 1; + } + + /* When using host mode, the paths are registered before NodeJS is properly initialized, + * delay the execution path registration until it is properly registered + */ + if (node_impl->delayed_execution_paths != nullptr) + { + node_impl->delayed_execution_paths->push_back(path); + return 0; + } + + loader_impl_async_execution_path_safe_type execution_path_safe(node_impl, static_cast(path)); + + /* Check if we are in the JavaScript thread */ + if (node_impl->js_thread_id == std::this_thread::get_id()) + { + /* We are already in the V8 thread, we can call safely */ + node_loader_impl_execution_path_safe(node_impl->env, &execution_path_safe); + } + else + { + /* Submit the task to the async queue */ + loader_impl_threadsafe_invoke_type invoke(node_impl->threadsafe_execution_path, execution_path_safe); + } return 0; } diff --git a/source/loaders/node_loader/source/node_loader_port.cpp b/source/loaders/node_loader/source/node_loader_port.cpp index 2238c0ab3..773e62cca 100644 --- a/source/loaders/node_loader/source/node_loader_port.cpp +++ b/source/loaders/node_loader/source/node_loader_port.cpp @@ -805,6 +805,9 @@ napi_value node_loader_port_register_bootstrap_startup(napi_env env, napi_callba loader_impl impl = loader_get_impl(node_loader_tag); loader_impl_node node_impl = static_cast(loader_impl_get(impl)); + /* Define environment, required to initialize the runtime properly */ + node_loader_impl_env(node_impl, env); + /* Return all the values required for the bootstrap startup */ return node_loader_impl_register_bootstrap_startup(node_impl, env); } From 55a8553a6396f7f0791f8ec3921a2da9ccc05ea6 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 5 Dec 2024 18:35:10 +0100 Subject: [PATCH 10/66] Add base for destroy in node. --- .../node_loader/source/node_loader_impl.cpp | 74 ++++++++++++++----- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/source/loaders/node_loader/source/node_loader_impl.cpp b/source/loaders/node_loader/source/node_loader_impl.cpp index 33a0ea036..b32154153 100644 --- a/source/loaders/node_loader/source/node_loader_impl.cpp +++ b/source/loaders/node_loader/source/node_loader_impl.cpp @@ -874,6 +874,8 @@ static void node_loader_impl_handle_promise_safe(napi_env env, loader_impl_async static void node_loader_impl_destroy_safe(napi_env env, loader_impl_async_destroy_safe_type *destroy_safe); +static void node_loader_impl_destroy_hook(loader_impl_node node_impl); + static char *node_loader_impl_get_property_as_char(napi_env env, napi_value obj, const char *prop); /* Loader */ @@ -3708,6 +3710,9 @@ void *node_loader_impl_register(void *node_impl_ptr, void *env_ptr, void *functi } delete paths; + + /* Trigger destroy hook */ + node_loader_impl_destroy_hook(node_impl); } /* Close scope */ @@ -3985,6 +3990,9 @@ loader_impl_data node_loader_impl_initialize(loader_impl impl, configuration con /* Initialize delayed execution paths for register them once it has been initialized */ node_impl->delayed_execution_paths = new std::vector(); + + /* Result will never be defined properly */ + node_impl->result = 0; } /* Register initialization */ @@ -4267,6 +4275,32 @@ napi_value node_loader_impl_promise_await(loader_impl_node node_impl, napi_env e return promise; } +static void node_loader_impl_destroy_close_cb(loader_impl_node node_impl, napi_env env) +{ + if (--node_impl->extra_active_handles == 0) + { + if (loader_impl_get_option_host(node_impl->impl) == 0) + { + node_loader_impl_try_destroy(node_impl); + } + else + { + node_impl->threadsafe_initialize.abort(env); + node_impl->threadsafe_execution_path.abort(env); + node_impl->threadsafe_load_from_file.abort(env); + node_impl->threadsafe_load_from_memory.abort(env); + node_impl->threadsafe_clear.abort(env); + node_impl->threadsafe_discover.abort(env); + node_impl->threadsafe_func_call.abort(env); + node_impl->threadsafe_func_await.abort(env); + node_impl->threadsafe_func_destroy.abort(env); + node_impl->threadsafe_future_await.abort(env); + node_impl->threadsafe_future_delete.abort(env); + node_impl->threadsafe_destroy.abort(env); + } + } +} + #define container_of(ptr, type, member) \ (type *)((char *)(ptr) - (char *)&((type *)0)->member) @@ -4275,10 +4309,7 @@ static void node_loader_impl_destroy_prepare_close_cb(uv_handle_t *handle) uv_prepare_t *prepare = (uv_prepare_t *)handle; loader_impl_node node_impl = container_of(prepare, struct loader_impl_node_type, destroy_prepare); - if (--node_impl->extra_active_handles == 0) - { - node_loader_impl_try_destroy(node_impl); - } + node_loader_impl_destroy_close_cb(node_impl, node_impl->env); } static void node_loader_impl_destroy_check_close_cb(uv_handle_t *handle) @@ -4286,10 +4317,7 @@ static void node_loader_impl_destroy_check_close_cb(uv_handle_t *handle) uv_check_t *check = (uv_check_t *)handle; loader_impl_node node_impl = container_of(check, struct loader_impl_node_type, destroy_check); - if (--node_impl->extra_active_handles == 0) - { - node_loader_impl_try_destroy(node_impl); - } + node_loader_impl_destroy_close_cb(node_impl, node_impl->env); } static void node_loader_impl_destroy_cb(loader_impl_node node_impl) @@ -4329,6 +4357,15 @@ static void node_loader_impl_destroy_check_cb(uv_check_t *handle) node_loader_impl_destroy_cb(node_impl); } +void node_loader_impl_destroy_hook(loader_impl_node node_impl) +{ + node_impl->extra_active_handles.store(2); + uv_prepare_init(node_impl->thread_loop, &node_impl->destroy_prepare); + uv_check_init(node_impl->thread_loop, &node_impl->destroy_check); + uv_prepare_start(&node_impl->destroy_prepare, &node_loader_impl_destroy_prepare_cb); + uv_check_start(&node_impl->destroy_check, &node_loader_impl_destroy_check_cb); +} + void node_loader_impl_destroy_safe(napi_env env, loader_impl_async_destroy_safe_type *destroy_safe) { napi_status status; @@ -4349,11 +4386,7 @@ void node_loader_impl_destroy_safe(napi_env env, loader_impl_async_destroy_safe_ } else { - node_impl->extra_active_handles.store(2); - uv_prepare_init(node_impl->thread_loop, &node_impl->destroy_prepare); - uv_check_init(node_impl->thread_loop, &node_impl->destroy_check); - uv_prepare_start(&node_impl->destroy_prepare, &node_loader_impl_destroy_prepare_cb); - uv_check_start(&node_impl->destroy_check, &node_loader_impl_destroy_check_cb); + node_loader_impl_destroy_hook(node_impl); } /* Close scope */ @@ -4500,6 +4533,7 @@ void node_loader_impl_destroy_safe_impl(loader_impl_node node_impl, napi_env env node_loader_impl_exception(env, status); /* Clear thread safe functions except by destroy one */ + if (loader_impl_get_option_host(node_impl->impl) == 0) { node_impl->threadsafe_initialize.abort(env); node_impl->threadsafe_execution_path.abort(env); @@ -4552,9 +4586,12 @@ void node_loader_impl_try_destroy(loader_impl_node node_impl) loader_impl_threadsafe_invoke_type invoke(node_impl->threadsafe_destroy, destroy_safe); } - if (destroy_safe.has_finished) + if (loader_impl_get_option_host(node_impl->impl) == 0) { - node_impl->threadsafe_destroy.abort(node_impl->env); + if (destroy_safe.has_finished) + { + node_impl->threadsafe_destroy.abort(node_impl->env); + } } } @@ -4570,8 +4607,11 @@ int node_loader_impl_destroy(loader_impl impl) /* Call destroy function with thread safe */ node_loader_impl_try_destroy(node_impl); - /* Wait for node thread to finish */ - uv_thread_join(&node_impl->thread); + if (loader_impl_get_option_host(impl) == 0) + { + /* Wait for node thread to finish */ + uv_thread_join(&node_impl->thread); + } /* Clear condition syncronization object */ uv_cond_destroy(&node_impl->cond); From 9bbc9a63844e072609ec05ce24113afdafa387b7 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 19 Dec 2024 03:34:31 +0100 Subject: [PATCH 11/66] Host destruction working properly with nodejs. --- source/loader/source/loader.c | 13 ++++++++- source/loaders/node_loader/CMakeLists.txt | 2 +- .../node_loader/bootstrap/lib/bootstrap.js | 6 ++++ .../node_loader/source/node_loader_impl.cpp | 6 ++-- .../source/node_loader_trampoline.cpp | 1 - source/metacall/source/metacall.c | 9 ++++++ source/metacall/source/metacall_link.c | 3 +- source/ports/node_port/CMakeLists.txt | 2 +- source/ports/node_port/index.js | 28 ++++++++++--------- 9 files changed, 49 insertions(+), 21 deletions(-) diff --git a/source/loader/source/loader.c b/source/loader/source/loader.c index 8fc490118..73803e7ed 100644 --- a/source/loader/source/loader.c +++ b/source/loader/source/loader.c @@ -210,7 +210,18 @@ int loader_initialize_host(const loader_tag tag) return 1; } - return loader_impl_initialize(&loader_manager, p, plugin_impl_type(p, loader_impl)); + if (loader_impl_initialize(&loader_manager, p, plugin_impl_type(p, loader_impl)) != 0) + { + return 1; + } + else + { + loader_manager_impl manager_impl = plugin_manager_impl_type(&loader_manager, loader_manager_impl); + + manager_impl->host = p; + + return 0; + } } int loader_is_initialized(const loader_tag tag) diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index 70108f53e..a9bf13c67 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -158,7 +158,7 @@ target_link_libraries(${target} ${META_PROJECT_NAME}::metacall # MetaCall library # TODO: Implement delayed load - # ${NodeJS_LIBRARY} # NodeJS library + ${NodeJS_LIBRARY} # NodeJS library PUBLIC ${DEFAULT_LIBRARIES} diff --git a/source/loaders/node_loader/bootstrap/lib/bootstrap.js b/source/loaders/node_loader/bootstrap/lib/bootstrap.js index 4f2c5b766..8201b220a 100644 --- a/source/loaders/node_loader/bootstrap/lib/bootstrap.js +++ b/source/loaders/node_loader/bootstrap/lib/bootstrap.js @@ -436,6 +436,12 @@ const startup = (impl, ptr, trampoline_exports) => { 'await_function': node_loader_trampoline_await_function(trampoline), 'await_future': node_loader_trampoline_await_future(trampoline), }); + + // This function must destroy all the loaders but + // delaying the NodeJS Loader library unloading + if (trampoline_exports) { + process.on('exit', () => trampoline.destroy(node_loader_ptr)); + } } catch (ex) { console.log('Exception in bootstrap.js trampoline initialization:', ex); } diff --git a/source/loaders/node_loader/source/node_loader_impl.cpp b/source/loaders/node_loader/source/node_loader_impl.cpp index b32154153..281221d40 100644 --- a/source/loaders/node_loader/source/node_loader_impl.cpp +++ b/source/loaders/node_loader/source/node_loader_impl.cpp @@ -4604,11 +4604,11 @@ int node_loader_impl_destroy(loader_impl impl) return 1; } - /* Call destroy function with thread safe */ - node_loader_impl_try_destroy(node_impl); - if (loader_impl_get_option_host(impl) == 0) { + /* Call destroy function with thread safe */ + node_loader_impl_try_destroy(node_impl); + /* Wait for node thread to finish */ uv_thread_join(&node_impl->thread); } diff --git a/source/loaders/node_loader/source/node_loader_trampoline.cpp b/source/loaders/node_loader/source/node_loader_trampoline.cpp index 6314d2d30..7ed654358 100644 --- a/source/loaders/node_loader/source/node_loader_trampoline.cpp +++ b/source/loaders/node_loader/source/node_loader_trampoline.cpp @@ -244,7 +244,6 @@ napi_value node_loader_trampoline_reject(napi_env env, napi_callback_info info) napi_value node_loader_trampoline_destroy(napi_env env, napi_callback_info info) { napi_status status; - const size_t args_size = 1; size_t argc = args_size; napi_value recv; diff --git a/source/metacall/source/metacall.c b/source/metacall/source/metacall.c index d7d19f815..0962d974e 100644 --- a/source/metacall/source/metacall.c +++ b/source/metacall/source/metacall.c @@ -72,6 +72,7 @@ static loader_path plugin_path = { 0 }; static int metacall_plugin_extension_load(void); static void *metacallv_method(void *target, const char *name, method_invoke_ptr call, vector v, void *args[], size_t size); static type_id *metacall_type_ids(void *args[], size_t size); +static void metacall_destructor(void); static void metacall_detour_destructor(void); /* -- Costructors -- */ @@ -111,10 +112,18 @@ portability_constructor(metacall_constructor) metacall_value_destroy(config[0].options); exit(1); } + + /* Register the destructor on exit */ + atexit(metacall_destructor); } } } +void metacall_destructor(void) +{ + metacall_destroy(); +} + /* -- Methods -- */ const char *metacall_serial(void) diff --git a/source/metacall/source/metacall_link.c b/source/metacall/source/metacall_link.c index d1343c52d..9bad2939a 100644 --- a/source/metacall/source/metacall_link.c +++ b/source/metacall/source/metacall_link.c @@ -92,7 +92,8 @@ void *metacall_link_hook(void *handle, const char *symbol) /* Intercept function if any */ void *ptr = set_get(metacall_link_table, (set_key)symbol); - log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall detour link interception: %s -> %p", symbol, ptr); + /* TODO: Disable logs here until log is completely thread safe and async signal safe */ + /* log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall detour link interception: %s -> %p", symbol, ptr); */ if (ptr != NULL) { diff --git a/source/ports/node_port/CMakeLists.txt b/source/ports/node_port/CMakeLists.txt index 9cbb94fbc..c6531650a 100644 --- a/source/ports/node_port/CMakeLists.txt +++ b/source/ports/node_port/CMakeLists.txt @@ -225,7 +225,7 @@ set(node_port_test_exec "${node_port_test}_executable") message(STATUS "Test ${node_port_test_exec}") add_test(NAME ${node_port_test_exec} - COMMAND ${NodeJS_EXECUTABLE} test/index.js + COMMAND ${NodeJS_EXECUTABLE} -e "require('./test.js').main()" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/source/ports/node_port/index.js b/source/ports/node_port/index.js index f96f870d7..2372b3fd5 100644 --- a/source/ports/node_port/index.js +++ b/source/ports/node_port/index.js @@ -22,10 +22,10 @@ const mod = require('module'); const path = require('path'); -const fs = require('fs').promises; +const fs = require('fs'); const { URL } = require('url'); /* TODO: RPC Loader */ -async function findFilesRecursively(dirPattern, filePattern, depthLimit = Infinity) { +const findFilesRecursively = (dirPattern, filePattern, depthLimit = Infinity) => { const stack = [{ dir: dirPattern, depth: 0 }]; const files = []; const dirRegex = new RegExp(dirPattern); @@ -43,11 +43,11 @@ async function findFilesRecursively(dirPattern, filePattern, depthLimit = Infini continue; } - const items = await fs.readdir(dir); + const items = fs.readdirSync(dir); for (const item of items) { const fullPath = path.join(dir, item); - const stat = await fs.stat(fullPath); + const stat = fs.statSync(fullPath); if (stat.isDirectory()) { stack.push({ dir: fullPath, depth: depth + 1 }); @@ -61,7 +61,7 @@ async function findFilesRecursively(dirPattern, filePattern, depthLimit = Infini } return files; -} +}; const platformInstallPaths = () => { switch (process.platform) { @@ -83,7 +83,7 @@ const platformInstallPaths = () => { } throw new Error(`Platform ${process.platform} not supported`) -} +}; const searchPaths = () => { const customPath = process.env['METACALL_INSTALL_PATH']; @@ -96,13 +96,13 @@ const searchPaths = () => { } return platformInstallPaths() -} +}; -const findLibrary = async () => { +const findLibrary = () => { const searchData = searchPaths(); for (const p of searchData.paths) { - const files = await findFilesRecursively(p, searchData.name, 0); + const files = findFilesRecursively(p, searchData.name, 0); if (files.length !== 0) { return files[0]; @@ -110,7 +110,7 @@ const findLibrary = async () => { } throw new Error('MetaCall library not found, if you have it in a special folder, define it through METACALL_INSTALL_PATH') -} +}; const addon = (() => { try { @@ -127,7 +127,9 @@ const addon = (() => { */ process.env['METACALL_HOST'] = 'node'; - findLibrary().then(library => { + try { + const library = findLibrary(); + const { constants } = require('os'); const m = { exports: {} }; @@ -148,10 +150,10 @@ const addon = (() => { process.argv = argv; return m.exports; - }).catch(err => { + } catch (err) { console.log(err); process.exit(1); - }); + } } })(); From 10f72e1810ec872ec202b550945ff3f1b8538622 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 19 Dec 2024 17:17:01 +0100 Subject: [PATCH 12/66] Add preload of sanitizers for node tests with node executable. --- cmake/CompileOptions.cmake | 33 +++++++++++++++++++++++++++ source/ports/node_port/CMakeLists.txt | 1 + 2 files changed, 34 insertions(+) diff --git a/cmake/CompileOptions.cmake b/cmake/CompileOptions.cmake index f569a6c16..a5610945c 100644 --- a/cmake/CompileOptions.cmake +++ b/cmake/CompileOptions.cmake @@ -149,6 +149,39 @@ else() set(SANITIZER_COMPILE_DEFINITIONS) endif() +if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang") + if(OPTION_BUILD_THREAD_SANITIZER) + execute_process(COMMAND ${CMAKE_C_COMPILER} -print-file-name=libtsan${CMAKE_SHARED_LIBRARY_SUFFIX} OUTPUT_VARIABLE LIBTSAN_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) + set(SANITIZER_LIBRARIES_PATH + "${LIBTSAN_PATH}" + ) + elseif(OPTION_BUILD_MEMORY_SANITIZER) + set(SANITIZER_LIBRARIES_PATH) # TODO + elseif(OPTION_BUILD_ADDRESS_SANITIZER) + execute_process(COMMAND ${CMAKE_C_COMPILER} -print-file-name=libasan${CMAKE_SHARED_LIBRARY_SUFFIX} OUTPUT_VARIABLE LIBASAN_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${CMAKE_C_COMPILER} -print-file-name=libubsan${CMAKE_SHARED_LIBRARY_SUFFIX} OUTPUT_VARIABLE LIBUBSAN_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) + set(SANITIZER_LIBRARIES_PATH + "${LIBASAN_PATH}" + "${LIBUBSAN_PATH}" + ) + endif() +endif() + +if(SANITIZER_LIBRARIES_PATH) + if(PROJECT_OS_LINUX) + list(JOIN SANITIZER_LIBRARIES_PATH " " SANITIZER_LIBRARIES_PATH_JOINED) + set(TESTS_SANITIZER_PRELOAD_ENVIRONMENT_VARIABLES + "LD_PRELOAD=${SANITIZER_LIBRARIES_PATH_JOINED}" + ) + elseif(PROJECT_OS_FAMILY MATCHES "macos") + list(JOIN SANITIZER_LIBRARIES_PATH ":" SANITIZER_LIBRARIES_PATH_JOINED) + set(TESTS_SANITIZER_PRELOAD_ENVIRONMENT_VARIABLES + "DYLD_INSERT_LIBRARIES=${SANITIZER_LIBRARIES_PATH_JOINED}" + "DYLD_FORCE_FLAT_NAMESPACE=1" + ) + endif() +endif() + if((PROJECT_OS_WIN AND MSVC) OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # MSVC and Clang do not require to link manually the sanitizer libraries set(SANITIZER_LIBRARIES) diff --git a/source/ports/node_port/CMakeLists.txt b/source/ports/node_port/CMakeLists.txt index c6531650a..5ddccd023 100644 --- a/source/ports/node_port/CMakeLists.txt +++ b/source/ports/node_port/CMakeLists.txt @@ -243,4 +243,5 @@ test_environment_variables(${node_port_test_exec} ${TESTS_ENVIRONMENT_VARIABLES_RS} ${TESTS_ENVIRONMENT_VARIABLES_OPENSSL} "METACALL_INSTALL_PATH=${PROJECT_OUTPUT_DIR}" + ${TESTS_SANITIZER_PRELOAD_ENVIRONMENT_VARIABLES} ) From ad08aec46e52cde5df25bacba4db040baff7f10c Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 19 Dec 2024 17:18:27 +0100 Subject: [PATCH 13/66] Change metacall_destroy signature, improved bugs with atexit. --- .../source/metacall_cs_call_bench.cpp | 4 +++- .../source/metacall_node_call_bench.cpp | 4 +++- .../source/metacall_py_call_bench.cpp | 5 +---- .../source/metacall_py_init_bench.cpp | 5 +---- .../source/metacall_rb_call_bench.cpp | 5 +---- source/cli/metacallcli/source/application.cpp | 7 +------ source/examples/metacalllog/main.cpp | 4 +++- source/metacall/include/metacall/metacall.h | 5 +---- source/metacall/source/metacall.c | 19 +++++-------------- source/metacall/source/metacall_fork.c | 10 ++-------- .../src/main/java/metacall/Bindings.java | 2 +- source/ports/rs_port/src/bindings.rs | 4 ++-- source/ports/rs_port/src/init.rs | 10 +++------- .../ports/zig_port/src/metacall-bindings.zig | 2 +- source/ports/zig_port/src/root.zig | 9 ++------- .../ports/zig_port/src/tests/integrated.zig | 2 +- .../source/metacall_backtrace_plugin_test.cpp | 2 +- .../source/metacall_c_lib_test.cpp | 2 +- .../source/metacall_c_test.cpp | 2 +- .../source/metacall_callback_complex_test.cpp | 2 +- .../source/metacall_cast_test.cpp | 2 +- .../source/metacall_clear_test.cpp | 2 +- .../metacall_cli_core_plugin_await_test.cpp | 2 +- .../source/metacall_cli_core_plugin_test.cpp | 2 +- .../source/metacall_cobol_test.cpp | 2 +- .../metacall_configuration_default_test.cpp | 2 +- .../metacall_configuration_exec_path_test.cpp | 2 +- .../metacall_cs_test/source/environment.cpp | 2 +- .../source/metacall_csharp_function_test.cpp | 2 +- .../metacall_csharp_static_class_test.cpp | 2 +- .../source/metacall_depends_test.cpp | 2 +- .../source/metacall_distributable_test.cpp | 2 +- .../source/metacall_ducktype_test.cpp | 2 +- .../metacall_duplicated_handle_test.cpp | 2 +- .../metacall_duplicated_symbols_test.cpp | 2 +- .../source/metacall_ext_test.cpp | 2 +- .../source/metacall_file_fail_test.cpp | 2 +- .../source/metacall_file_glob_test.cpp | 2 +- .../source/metacall_file_test.cpp | 2 +- .../source/metacall_fork_test.cpp | 2 +- .../source/metacall_function_test.cpp | 2 +- .../source/metacall_handle_export_test.cpp | 2 +- .../source/metacall_handle_get_test.cpp | 2 +- .../source/metacall_init_fini_test.cpp | 2 +- ..._initialize_destroy_multiple_node_test.cpp | 6 +++--- ...acall_initialize_destroy_multiple_test.cpp | 6 +++--- .../source/metacall_initialize_ex_test.cpp | 2 +- .../source/metacall_initialize_test.cpp | 2 +- .../source/metacall_inspect_test.cpp | 2 +- .../source/environment.cpp | 2 +- .../source/metacall_invalid_loader_test.cpp | 2 +- .../source/metacall_java_test.cpp | 2 +- .../source/metacall_julia_test.cpp | 2 +- ...all_library_path_without_env_vars_test.cpp | 2 +- .../source/metacall_llvm_test.cpp | 2 +- .../metacall_load_configuration_fail_test.cpp | 2 +- ...ll_load_configuration_node_python_test.cpp | 2 +- ...ll_load_configuration_python_node_test.cpp | 2 +- ...acall_load_configuration_relative_test.cpp | 2 +- .../metacall_load_configuration_test.cpp | 2 +- .../metacall_load_memory_empty_test.cpp | 2 +- .../source/metacall_load_memory_test.cpp | 2 +- .../source/metacall_logs_test.cpp | 2 +- .../source/metacall_lua_test.cpp | 2 +- .../source/metacall_map_await_test.cpp | 2 +- .../source/metacall_map_test.cpp | 2 +- .../metacall_node_async_multiple_test.cpp | 2 +- .../metacall_node_async_resources_test.cpp | 2 +- .../source/metacall_node_async_test.cpp | 2 +- .../source/metacall_node_await_chain_test.cpp | 2 +- .../source/metacall_node_call_test.cpp | 2 +- .../source/metacall_node_callback_test.cpp | 2 +- .../source/metacall_node_clear_mem_test.cpp | 2 +- .../metacall_node_default_export_test.cpp | 2 +- .../metacall_node_event_loop_signal_test.cpp | 2 +- .../source/metacall_node_event_loop_test.cpp | 2 +- .../source/metacall_node_exception_test.cpp | 2 +- .../source/metacall_node_extension_test.cpp | 2 +- .../metacall_node_fail_env_var_test.cpp | 2 +- .../metacall_node_fail_load_leak_test.cpp | 2 +- .../source/metacall_node_fail_test.cpp | 2 +- .../source/metacall_node_inline_test.cpp | 2 +- ...etacall_node_multithread_deadlock_test.cpp | 2 +- .../source/metacall_node_native_code_test.cpp | 2 +- .../source/metacall_node_port_await_test.cpp | 2 +- .../source/metacall_node_port_rs_test.cpp | 2 +- .../source/metacall_node_port_test.cpp | 2 +- ...l_node_python_async_after_destroy_test.cpp | 2 +- ...tacall_node_python_await_extended_test.cpp | 2 +- .../metacall_node_python_await_test.cpp | 2 +- .../metacall_node_python_deadlock_test.cpp | 2 +- .../metacall_node_python_exception_test.cpp | 2 +- .../metacall_node_python_port_mock_test.cpp | 2 +- .../metacall_node_python_port_ruby_test.cpp | 2 +- .../source/metacall_node_python_ruby_test.cpp | 2 +- .../source/metacall_node_reentrant_test.cpp | 2 +- .../metacall_node_signal_handler_test.cpp | 2 +- .../source/metacall_node_test.cpp | 2 +- .../source/metacall_node_typescript_test.cpp | 2 +- ...ll_plugin_extension_destroy_order_test.cpp | 2 +- ...all_plugin_extension_invalid_path_test.cpp | 2 +- .../metacall_plugin_extension_local_test.cpp | 2 +- .../source/metacall_plugin_extension_test.cpp | 2 +- .../source/metacall_python_async_test.cpp | 2 +- .../source/metacall_python_await_test.cpp | 2 +- .../source/metacall_python_builtins_test.cpp | 2 +- .../source/metacall_python_callback_test.cpp | 2 +- .../source/metacall_python_dict_test.cpp | 2 +- .../source/metacall_python_exception_test.cpp | 2 +- .../source/metacall_python_fail_test.cpp | 2 +- .../source/metacall_python_gc_test.cpp | 2 +- .../metacall_python_loader_port_test.cpp | 2 +- .../source/metacall_python_model_test.cpp | 2 +- .../metacall_python_node_await_test.cpp | 2 +- .../metacall_python_object_class_test.cpp | 2 +- .../source/metacall_python_open_test.cpp | 2 +- .../source/metacall_python_pointer_test.cpp | 2 +- .../metacall_python_port_callback_test.cpp | 2 +- .../metacall_python_port_https_test.cpp | 2 +- .../metacall_python_port_import_test.cpp | 2 +- .../metacall_python_port_pointer_test.cpp | 2 +- .../source/metacall_python_port_test.cpp | 2 +- .../source/metacall_python_reentrant_test.cpp | 2 +- .../metacall_python_relative_path_test.cpp | 2 +- .../source/metacall_python_test.cpp | 2 +- .../source/metacall_python_varargs_test.cpp | 2 +- .../metacall_python_without_env_vars_test.cpp | 2 +- ...metacall_python_without_functions_test.cpp | 2 +- .../source/metacall_reinitialize_test.cpp | 2 +- .../source/metacall_reload_functions_test.cpp | 2 +- .../source/metacall_return_monad_test.cpp | 2 +- .../source/metacall_rpc_test.cpp | 2 +- .../source/metacall_ruby_fail_empty_test.cpp | 2 +- .../source/metacall_ruby_fail_test.cpp | 2 +- .../metacall_ruby_object_class_test.cpp | 2 +- .../metacall_ruby_parser_integration_test.cpp | 2 +- .../metacall_ruby_rails_integration_test.cpp | 2 +- .../source/metacall_ruby_test.cpp | 2 +- .../source/metacall_rust_class_test.cpp | 2 +- .../metacall_rust_load_from_mem_test.cpp | 2 +- ...call_rust_load_from_package_class_test.cpp | 2 +- ...tacall_rust_load_from_package_dep_test.cpp | 2 +- .../metacall_rust_load_from_package_test.cpp | 2 +- .../source/metacall_rust_test.cpp | 2 +- .../source/metacall_sandbox_plugin_test.cpp | 18 +++++++++--------- .../metacall_test/source/metacall_test.cpp | 2 +- .../source/metacall_test_split.cpp | 4 ++-- .../metacall_typescript_call_map_test.cpp | 2 +- .../metacall_typescript_jsx_default_test.cpp | 2 +- .../source/metacall_typescript_node_test.cpp | 2 +- .../metacall_typescript_require_test.cpp | 2 +- .../source/metacall_typescript_test.cpp | 2 +- ...metacall_typescript_tsx_loop_fail_test.cpp | 2 +- .../source/metacall_typescript_tsx_test.cpp | 2 +- .../source/metacall_wasm_test.cpp | 2 +- 155 files changed, 183 insertions(+), 218 deletions(-) diff --git a/source/benchmarks/metacall_cs_call_bench/source/metacall_cs_call_bench.cpp b/source/benchmarks/metacall_cs_call_bench/source/metacall_cs_call_bench.cpp index e16f199a8..d0acd24cc 100644 --- a/source/benchmarks/metacall_cs_call_bench/source/metacall_cs_call_bench.cpp +++ b/source/benchmarks/metacall_cs_call_bench/source/metacall_cs_call_bench.cpp @@ -186,5 +186,7 @@ int main(int argc, char **argv) ::benchmark::RunSpecifiedBenchmarks(); - return metacall_destroy(); + metacall_destroy(); + + return 0; } diff --git a/source/benchmarks/metacall_node_call_bench/source/metacall_node_call_bench.cpp b/source/benchmarks/metacall_node_call_bench/source/metacall_node_call_bench.cpp index f66efa2ab..15861f525 100644 --- a/source/benchmarks/metacall_node_call_bench/source/metacall_node_call_bench.cpp +++ b/source/benchmarks/metacall_node_call_bench/source/metacall_node_call_bench.cpp @@ -292,5 +292,7 @@ int main(int argc, char **argv) } #endif /* OPTION_BUILD_LOADERS_NODE */ - return metacall_destroy(); + metacall_destroy(); + + return 0; } diff --git a/source/benchmarks/metacall_py_call_bench/source/metacall_py_call_bench.cpp b/source/benchmarks/metacall_py_call_bench/source/metacall_py_call_bench.cpp index 399ebe239..74d0bc7c5 100644 --- a/source/benchmarks/metacall_py_call_bench/source/metacall_py_call_bench.cpp +++ b/source/benchmarks/metacall_py_call_bench/source/metacall_py_call_bench.cpp @@ -178,10 +178,7 @@ int main(int argc, char *argv[]) ::benchmark::RunSpecifiedBenchmarks(); ::benchmark::Shutdown(); - if (metacall_destroy() != 0) - { - return 4; - } + metacall_destroy(); return 0; } diff --git a/source/benchmarks/metacall_py_init_bench/source/metacall_py_init_bench.cpp b/source/benchmarks/metacall_py_init_bench/source/metacall_py_init_bench.cpp index 7021aad6b..ee60fee48 100644 --- a/source/benchmarks/metacall_py_init_bench/source/metacall_py_init_bench.cpp +++ b/source/benchmarks/metacall_py_init_bench/source/metacall_py_init_bench.cpp @@ -130,10 +130,7 @@ BENCHMARK_DEFINE_F(metacall_py_init_bench, destroy) /* Python */ #if defined(OPTION_BUILD_LOADERS_PY) { - if (metacall_destroy() != 0) - { - state.SkipWithError("Error destroying MetaCall"); - } + metacall_destroy(); } #endif /* OPTION_BUILD_LOADERS_PY */ } diff --git a/source/benchmarks/metacall_rb_call_bench/source/metacall_rb_call_bench.cpp b/source/benchmarks/metacall_rb_call_bench/source/metacall_rb_call_bench.cpp index ddcfd2795..903530eae 100644 --- a/source/benchmarks/metacall_rb_call_bench/source/metacall_rb_call_bench.cpp +++ b/source/benchmarks/metacall_rb_call_bench/source/metacall_rb_call_bench.cpp @@ -198,10 +198,7 @@ int main(int argc, char *argv[]) ::benchmark::RunSpecifiedBenchmarks(); ::benchmark::Shutdown(); - if (metacall_destroy() != 0) - { - return 4; - } + metacall_destroy(); return 0; } diff --git a/source/cli/metacallcli/source/application.cpp b/source/cli/metacallcli/source/application.cpp index b1b22761b..0ba037683 100644 --- a/source/cli/metacallcli/source/application.cpp +++ b/source/cli/metacallcli/source/application.cpp @@ -299,12 +299,7 @@ application::application(int argc, char *argv[]) : application::~application() { - int result = metacall_destroy(); - - if (result != 0) - { - std::cout << "Error while destroying MetaCall, exit code: " << result << std::endl; - } + metacall_destroy(); } void application::arguments_parse(std::vector &arguments) diff --git a/source/examples/metacalllog/main.cpp b/source/examples/metacalllog/main.cpp index e7b47deea..0b4ac01a9 100644 --- a/source/examples/metacalllog/main.cpp +++ b/source/examples/metacalllog/main.cpp @@ -143,5 +143,7 @@ int main(int, char *[]) /* Here you can load some scripts */ - return metacall_destroy(); + metacall_destroy(); + + return 0; } diff --git a/source/metacall/include/metacall/metacall.h b/source/metacall/include/metacall/metacall.h index 2ad427ca3..b7788e223 100644 --- a/source/metacall/include/metacall/metacall.h +++ b/source/metacall/include/metacall/metacall.h @@ -1488,11 +1488,8 @@ METACALL_API const char *metacall_plugin_path(void); /** * @brief * Destroy MetaCall library -* -* @return -* Zero if success, different from zero otherwise */ -METACALL_API int metacall_destroy(void); +METACALL_API void metacall_destroy(void); /** * @brief diff --git a/source/metacall/source/metacall.c b/source/metacall/source/metacall.c index 0962d974e..3fcc54b8c 100644 --- a/source/metacall/source/metacall.c +++ b/source/metacall/source/metacall.c @@ -72,7 +72,6 @@ static loader_path plugin_path = { 0 }; static int metacall_plugin_extension_load(void); static void *metacallv_method(void *target, const char *name, method_invoke_ptr call, vector v, void *args[], size_t size); static type_id *metacall_type_ids(void *args[], size_t size); -static void metacall_destructor(void); static void metacall_detour_destructor(void); /* -- Costructors -- */ @@ -114,16 +113,11 @@ portability_constructor(metacall_constructor) } /* Register the destructor on exit */ - atexit(metacall_destructor); + atexit(metacall_destroy); } } } -void metacall_destructor(void) -{ - metacall_destroy(); -} - /* -- Methods -- */ const char *metacall_serial(void) @@ -200,8 +194,6 @@ int metacall_plugin_extension_load(void) void metacall_detour_destructor(void) { - log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall detour destruction"); - /* Destroy link */ if (metacall_link_destroy() != 0) { @@ -2364,7 +2356,7 @@ const char *metacall_plugin_path(void) return plugin_path; } -int metacall_destroy(void) +void metacall_destroy(void) { if (metacall_initialize_flag == 0) { @@ -2374,17 +2366,16 @@ int metacall_destroy(void) /* Destroy configurations */ configuration_destroy(); - metacall_initialize_flag = 1; - /* Print stats from functions, classes, objects and exceptions */ reflect_memory_tracker_debug(); /* Set to null the plugin extension and core plugin handles */ plugin_extension_handle = NULL; plugin_core_handle = NULL; - } - return 0; + /* Set initialization flag to destroyed */ + metacall_initialize_flag = 1; + } } const struct metacall_version_type *metacall_version(void) diff --git a/source/metacall/source/metacall_fork.c b/source/metacall/source/metacall_fork.c index 6cbe972e6..cd1ec5022 100644 --- a/source/metacall/source/metacall_fork.c +++ b/source/metacall/source/metacall_fork.c @@ -172,10 +172,7 @@ NTSTATUS NTAPI metacall_fork_hook(ULONG ProcessFlags, log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall process fork auto destroy"); /* Destroy metacall before the fork */ - if (metacall_destroy() != 0) - { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall fork auto destruction"); - } + metacall_destroy(); /* Execute the real fork */ result = metacall_fork_trampoline(ProcessFlags, ProcessSecurityDescriptor, ThreadSecurityDescriptor, DebugPort, ProcessInformation); @@ -247,10 +244,7 @@ pid_t metacall_fork_hook(void) log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall process fork auto destroy"); /* Destroy metacall before the fork */ - if (metacall_destroy() != 0) - { - log_write("metacall", LOG_LEVEL_ERROR, "MetaCall fork auto destruction fail"); - } + metacall_destroy(); /* Execute the real fork */ pid = metacall_fork_trampoline(); diff --git a/source/ports/java_port/src/main/java/metacall/Bindings.java b/source/ports/java_port/src/main/java/metacall/Bindings.java index b1de4d1c4..71b93a729 100644 --- a/source/ports/java_port/src/main/java/metacall/Bindings.java +++ b/source/ports/java_port/src/main/java/metacall/Bindings.java @@ -31,7 +31,7 @@ public interface Bindings extends Library SizeT metacall_function_size(Pointer func); int metacall_function_async(Pointer func); - int metacall_destroy(); + void metacall_destroy(); //metacall_value.h Pointer metacall_value_create_int(int i); diff --git a/source/ports/rs_port/src/bindings.rs b/source/ports/rs_port/src/bindings.rs index fdfc35049..c4319b2ac 100644 --- a/source/ports/rs_port/src/bindings.rs +++ b/source/ports/rs_port/src/bindings.rs @@ -1355,8 +1355,8 @@ unsafe extern "C" { pub fn metacall_plugin_path() -> *const ::std::os::raw::c_char; } unsafe extern "C" { - #[doc = " @brief\n Destroy MetaCall library\n\n @return\n Zero if success, different from zero otherwise"] - pub fn metacall_destroy() -> ::std::os::raw::c_int; + #[doc = " @brief\n Destroy MetaCall library\n"] + pub fn metacall_destroy(); } unsafe extern "C" { #[doc = " @brief\n Provide the module version struct\n\n @return\n Static struct containing unpacked version"] diff --git a/source/ports/rs_port/src/init.rs b/source/ports/rs_port/src/init.rs index da09899a2..fb578600a 100644 --- a/source/ports/rs_port/src/init.rs +++ b/source/ports/rs_port/src/init.rs @@ -2,17 +2,13 @@ use crate::{ bindings::{metacall_destroy, metacall_initialize, metacall_is_initialized}, types::MetaCallInitError, }; -use std::{ffi::c_int, ptr}; +use std::ptr; -pub struct MetaCallDestroy(unsafe extern "C" fn() -> c_int); +pub struct MetaCallDestroy(unsafe extern "C" fn()); impl Drop for MetaCallDestroy { fn drop(&mut self) { - let code = unsafe { self.0() }; - - if code != 0 { - panic!("MetaCall failed to destroy with code: {}", code) - } + unsafe { self.0() } } } diff --git a/source/ports/zig_port/src/metacall-bindings.zig b/source/ports/zig_port/src/metacall-bindings.zig index 05243d242..0615eb723 100644 --- a/source/ports/zig_port/src/metacall-bindings.zig +++ b/source/ports/zig_port/src/metacall-bindings.zig @@ -1325,7 +1325,7 @@ pub extern fn metacall_deserialize(name: [*c]const u8, buffer: [*c]const u8, siz pub extern fn metacall_clear(handle: ?*anyopaque) c_int; pub extern fn metacall_plugin_extension() ?*anyopaque; pub extern fn metacall_plugin_path() [*c]const u8; -pub extern fn metacall_destroy() c_int; +pub extern fn metacall_destroy() void; pub extern fn metacall_version() [*c]const struct_metacall_version_type; pub extern fn metacall_version_hex_make(major: c_uint, minor: c_uint, patch: c_uint) u32; pub extern fn metacall_version_hex() u32; diff --git a/source/ports/zig_port/src/root.zig b/source/ports/zig_port/src/root.zig index bb88c3da0..6bc5054e0 100644 --- a/source/ports/zig_port/src/root.zig +++ b/source/ports/zig_port/src/root.zig @@ -9,13 +9,8 @@ pub fn init() !void { return error.FailedToInitMetacall; } /// Deinitializes MetaCall and returns an error if didn't succeed. -pub fn destroy() !void { - if (mb.metacall_destroy() != 0) - return error.FailedToDeinitMetacall; -} -/// Deinitializes MetaCall. -pub fn deinit() void { - _ = destroy() catch {}; +pub fn destroy() void { + mb.metacall_destroy(); } /// Loads files into MetaCall, strings should be null-terminated. diff --git a/source/ports/zig_port/src/tests/integrated.zig b/source/ports/zig_port/src/tests/integrated.zig index 8ee7089f3..70b46b798 100644 --- a/source/ports/zig_port/src/tests/integrated.zig +++ b/source/ports/zig_port/src/tests/integrated.zig @@ -38,5 +38,5 @@ pub fn main() !void { try std.testing.expect(ret_string.?[0] == 'h'); try std.testing.expect(ret_string.?[1] == 'i'); - defer metacall.deinit(); + defer metacall.destroy(); } diff --git a/source/tests/metacall_backtrace_plugin_test/source/metacall_backtrace_plugin_test.cpp b/source/tests/metacall_backtrace_plugin_test/source/metacall_backtrace_plugin_test.cpp index 900c8b0a2..6f70caf08 100644 --- a/source/tests/metacall_backtrace_plugin_test/source/metacall_backtrace_plugin_test.cpp +++ b/source/tests/metacall_backtrace_plugin_test/source/metacall_backtrace_plugin_test.cpp @@ -60,5 +60,5 @@ TEST_F(metacall_backtrace_plugin_test, DefaultConstructor) /* Generate a segmentation fault in order to catch it by backtrace plugin */ EXPECT_DEATH({ badass_function(); }, ""); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_c_lib_test/source/metacall_c_lib_test.cpp b/source/tests/metacall_c_lib_test/source/metacall_c_lib_test.cpp index 28e940a9b..83aa1a8de 100644 --- a/source/tests/metacall_c_lib_test/source/metacall_c_lib_test.cpp +++ b/source/tests/metacall_c_lib_test/source/metacall_c_lib_test.cpp @@ -93,5 +93,5 @@ TEST_F(metacall_c_lib_test, DefaultConstructor) metacall_value_destroy(args_destroy[0]); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_c_test/source/metacall_c_test.cpp b/source/tests/metacall_c_test/source/metacall_c_test.cpp index 2aff37a27..dc4cc606b 100644 --- a/source/tests/metacall_c_test/source/metacall_c_test.cpp +++ b/source/tests/metacall_c_test/source/metacall_c_test.cpp @@ -153,5 +153,5 @@ TEST_F(metacall_c_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_callback_complex_test/source/metacall_callback_complex_test.cpp b/source/tests/metacall_callback_complex_test/source/metacall_callback_complex_test.cpp index e608f1dcd..daf5717e5 100644 --- a/source/tests/metacall_callback_complex_test/source/metacall_callback_complex_test.cpp +++ b/source/tests/metacall_callback_complex_test/source/metacall_callback_complex_test.cpp @@ -151,5 +151,5 @@ TEST_F(metacall_callback_complex_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_cast_test/source/metacall_cast_test.cpp b/source/tests/metacall_cast_test/source/metacall_cast_test.cpp index 12cd28065..c22c55cc7 100644 --- a/source/tests/metacall_cast_test/source/metacall_cast_test.cpp +++ b/source/tests/metacall_cast_test/source/metacall_cast_test.cpp @@ -106,5 +106,5 @@ TEST_F(metacall_cast_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_clear_test/source/metacall_clear_test.cpp b/source/tests/metacall_clear_test/source/metacall_clear_test.cpp index 8c59a5bab..0a59ea23a 100644 --- a/source/tests/metacall_clear_test/source/metacall_clear_test.cpp +++ b/source/tests/metacall_clear_test/source/metacall_clear_test.cpp @@ -76,5 +76,5 @@ TEST_F(metacall_clear_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_cli_core_plugin_await_test/source/metacall_cli_core_plugin_await_test.cpp b/source/tests/metacall_cli_core_plugin_await_test/source/metacall_cli_core_plugin_await_test.cpp index 05b98823b..49a813bc5 100644 --- a/source/tests/metacall_cli_core_plugin_await_test/source/metacall_cli_core_plugin_await_test.cpp +++ b/source/tests/metacall_cli_core_plugin_await_test/source/metacall_cli_core_plugin_await_test.cpp @@ -123,5 +123,5 @@ TEST_F(metacall_cli_core_plugin_await_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_cli_core_plugin_test/source/metacall_cli_core_plugin_test.cpp b/source/tests/metacall_cli_core_plugin_test/source/metacall_cli_core_plugin_test.cpp index ec178460c..e86f93051 100644 --- a/source/tests/metacall_cli_core_plugin_test/source/metacall_cli_core_plugin_test.cpp +++ b/source/tests/metacall_cli_core_plugin_test/source/metacall_cli_core_plugin_test.cpp @@ -386,5 +386,5 @@ TEST_F(metacall_cli_core_plugin_test, DefaultConstructor) metacall_allocator_destroy(allocator); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_cobol_test/source/metacall_cobol_test.cpp b/source/tests/metacall_cobol_test/source/metacall_cobol_test.cpp index 7158b3bb6..d6aae1a2c 100644 --- a/source/tests/metacall_cobol_test/source/metacall_cobol_test.cpp +++ b/source/tests/metacall_cobol_test/source/metacall_cobol_test.cpp @@ -91,5 +91,5 @@ TEST_F(metacall_cobol_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_configuration_default_test/source/metacall_configuration_default_test.cpp b/source/tests/metacall_configuration_default_test/source/metacall_configuration_default_test.cpp index af04b08dc..e852b0f58 100644 --- a/source/tests/metacall_configuration_default_test/source/metacall_configuration_default_test.cpp +++ b/source/tests/metacall_configuration_default_test/source/metacall_configuration_default_test.cpp @@ -33,5 +33,5 @@ TEST_F(metacall_configuration_default_test, DefaultConstructor) ASSERT_EQ((int)0, (int)metacall_initialize()); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_configuration_exec_path_test/source/metacall_configuration_exec_path_test.cpp b/source/tests/metacall_configuration_exec_path_test/source/metacall_configuration_exec_path_test.cpp index 48d998782..92fa6eac5 100644 --- a/source/tests/metacall_configuration_exec_path_test/source/metacall_configuration_exec_path_test.cpp +++ b/source/tests/metacall_configuration_exec_path_test/source/metacall_configuration_exec_path_test.cpp @@ -55,5 +55,5 @@ TEST_F(metacall_configuration_exec_path_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_cs_test/source/environment.cpp b/source/tests/metacall_cs_test/source/environment.cpp index 1753b9cd5..1affa4ae7 100644 --- a/source/tests/metacall_cs_test/source/environment.cpp +++ b/source/tests/metacall_cs_test/source/environment.cpp @@ -40,5 +40,5 @@ void environment::SetUp() void environment::TearDown() { - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_csharp_function_test/source/metacall_csharp_function_test.cpp b/source/tests/metacall_csharp_function_test/source/metacall_csharp_function_test.cpp index aaa0b4e96..799a1dc18 100644 --- a/source/tests/metacall_csharp_function_test/source/metacall_csharp_function_test.cpp +++ b/source/tests/metacall_csharp_function_test/source/metacall_csharp_function_test.cpp @@ -75,5 +75,5 @@ TEST_F(metacall_csharp_function_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_csharp_static_class_test/source/metacall_csharp_static_class_test.cpp b/source/tests/metacall_csharp_static_class_test/source/metacall_csharp_static_class_test.cpp index 5057a6efb..653616db1 100644 --- a/source/tests/metacall_csharp_static_class_test/source/metacall_csharp_static_class_test.cpp +++ b/source/tests/metacall_csharp_static_class_test/source/metacall_csharp_static_class_test.cpp @@ -79,5 +79,5 @@ TEST_F(metacall_csharp_static_class_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_depends_test/source/metacall_depends_test.cpp b/source/tests/metacall_depends_test/source/metacall_depends_test.cpp index 69fff39b4..0f82dd0da 100644 --- a/source/tests/metacall_depends_test/source/metacall_depends_test.cpp +++ b/source/tests/metacall_depends_test/source/metacall_depends_test.cpp @@ -82,5 +82,5 @@ TEST_F(metacall_depends_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_distributable_test/source/metacall_distributable_test.cpp b/source/tests/metacall_distributable_test/source/metacall_distributable_test.cpp index 03300dbb6..7aaec074b 100644 --- a/source/tests/metacall_distributable_test/source/metacall_distributable_test.cpp +++ b/source/tests/metacall_distributable_test/source/metacall_distributable_test.cpp @@ -276,5 +276,5 @@ TEST_F(metacall_distributable_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_C */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_ducktype_test/source/metacall_ducktype_test.cpp b/source/tests/metacall_ducktype_test/source/metacall_ducktype_test.cpp index 4f404762e..f912c0465 100644 --- a/source/tests/metacall_ducktype_test/source/metacall_ducktype_test.cpp +++ b/source/tests/metacall_ducktype_test/source/metacall_ducktype_test.cpp @@ -386,5 +386,5 @@ TEST_F(metacall_ducktype_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_JS */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_duplicated_handle_test/source/metacall_duplicated_handle_test.cpp b/source/tests/metacall_duplicated_handle_test/source/metacall_duplicated_handle_test.cpp index 370c3e565..72c2a2ad5 100644 --- a/source/tests/metacall_duplicated_handle_test/source/metacall_duplicated_handle_test.cpp +++ b/source/tests/metacall_duplicated_handle_test/source/metacall_duplicated_handle_test.cpp @@ -105,5 +105,5 @@ TEST_F(metacall_duplicated_handle_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_duplicated_symbols_test/source/metacall_duplicated_symbols_test.cpp b/source/tests/metacall_duplicated_symbols_test/source/metacall_duplicated_symbols_test.cpp index 26ce8456a..4306bd1ba 100644 --- a/source/tests/metacall_duplicated_symbols_test/source/metacall_duplicated_symbols_test.cpp +++ b/source/tests/metacall_duplicated_symbols_test/source/metacall_duplicated_symbols_test.cpp @@ -155,5 +155,5 @@ TEST_F(metacall_duplicated_symbols_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY + OPTION_BUILD_LOADERS_RB */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_ext_test/source/metacall_ext_test.cpp b/source/tests/metacall_ext_test/source/metacall_ext_test.cpp index 4a1501728..5894a3278 100644 --- a/source/tests/metacall_ext_test/source/metacall_ext_test.cpp +++ b/source/tests/metacall_ext_test/source/metacall_ext_test.cpp @@ -75,5 +75,5 @@ TEST_F(metacall_ext_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_file_fail_test/source/metacall_file_fail_test.cpp b/source/tests/metacall_file_fail_test/source/metacall_file_fail_test.cpp index ce3a62f7b..f5f4a0ba4 100644 --- a/source/tests/metacall_file_fail_test/source/metacall_file_fail_test.cpp +++ b/source/tests/metacall_file_fail_test/source/metacall_file_fail_test.cpp @@ -69,5 +69,5 @@ TEST_F(metacall_file_fail_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_file_glob_test/source/metacall_file_glob_test.cpp b/source/tests/metacall_file_glob_test/source/metacall_file_glob_test.cpp index 23edddd06..a5f3a2d2a 100644 --- a/source/tests/metacall_file_glob_test/source/metacall_file_glob_test.cpp +++ b/source/tests/metacall_file_glob_test/source/metacall_file_glob_test.cpp @@ -70,5 +70,5 @@ TEST_F(metacall_file_glob_test, DefaultConstructor) metacall_allocator_destroy(config_allocator); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_file_test/source/metacall_file_test.cpp b/source/tests/metacall_file_test/source/metacall_file_test.cpp index 029e8f0f6..aa635963c 100644 --- a/source/tests/metacall_file_test/source/metacall_file_test.cpp +++ b/source/tests/metacall_file_test/source/metacall_file_test.cpp @@ -77,5 +77,5 @@ TEST_F(metacall_file_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_fork_test/source/metacall_fork_test.cpp b/source/tests/metacall_fork_test/source/metacall_fork_test.cpp index 07c9e8734..c4f18db15 100644 --- a/source/tests/metacall_fork_test/source/metacall_fork_test.cpp +++ b/source/tests/metacall_fork_test/source/metacall_fork_test.cpp @@ -169,5 +169,5 @@ TEST_F(metacall_fork_test, DefaultConstructor) EXPECT_EQ((int)1, (int)pre_callback_fired); EXPECT_EQ((int)1, (int)post_callback_fired); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_function_test/source/metacall_function_test.cpp b/source/tests/metacall_function_test/source/metacall_function_test.cpp index 60c52efb1..2d015ea7f 100644 --- a/source/tests/metacall_function_test/source/metacall_function_test.cpp +++ b/source/tests/metacall_function_test/source/metacall_function_test.cpp @@ -272,5 +272,5 @@ TEST_F(metacall_function_test, DefaultConstructor) metacall_value_destroy(c_callback_factorial_impl_value); metacall_value_destroy(c_callback_factorial_value); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_handle_export_test/source/metacall_handle_export_test.cpp b/source/tests/metacall_handle_export_test/source/metacall_handle_export_test.cpp index 0c5fc5773..5c19f588a 100644 --- a/source/tests/metacall_handle_export_test/source/metacall_handle_export_test.cpp +++ b/source/tests/metacall_handle_export_test/source/metacall_handle_export_test.cpp @@ -139,5 +139,5 @@ TEST_F(metacall_handle_export_test, DefaultConstructor) metacall_allocator_destroy(allocator); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_handle_get_test/source/metacall_handle_get_test.cpp b/source/tests/metacall_handle_get_test/source/metacall_handle_get_test.cpp index c1d25836c..fb9202aba 100644 --- a/source/tests/metacall_handle_get_test/source/metacall_handle_get_test.cpp +++ b/source/tests/metacall_handle_get_test/source/metacall_handle_get_test.cpp @@ -158,5 +158,5 @@ TEST_F(metacall_handle_get_test, DefaultConstructor) metacall_allocator_destroy(allocator); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_init_fini_test/source/metacall_init_fini_test.cpp b/source/tests/metacall_init_fini_test/source/metacall_init_fini_test.cpp index 2290009dd..eba4e7206 100644 --- a/source/tests/metacall_init_fini_test/source/metacall_init_fini_test.cpp +++ b/source/tests/metacall_init_fini_test/source/metacall_init_fini_test.cpp @@ -55,5 +55,5 @@ TEST_F(metacall_init_fini_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_initialize_destroy_multiple_node_test/source/metacall_initialize_destroy_multiple_node_test.cpp b/source/tests/metacall_initialize_destroy_multiple_node_test/source/metacall_initialize_destroy_multiple_node_test.cpp index 12d008293..a38e64885 100644 --- a/source/tests/metacall_initialize_destroy_multiple_node_test/source/metacall_initialize_destroy_multiple_node_test.cpp +++ b/source/tests/metacall_initialize_destroy_multiple_node_test/source/metacall_initialize_destroy_multiple_node_test.cpp @@ -51,13 +51,13 @@ TEST_F(metacall_initialize_destroy_multiple_node_test, DefaultConstructor) ASSERT_EQ((int)0, (int)metacall_is_initialized(tag)); - ASSERT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); ASSERT_EQ((int)1, (int)metacall_is_initialized(tag)); } #endif /* OPTION_BUILD_LOADERS_NODE */ - ASSERT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); - ASSERT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_initialize_destroy_multiple_test/source/metacall_initialize_destroy_multiple_test.cpp b/source/tests/metacall_initialize_destroy_multiple_test/source/metacall_initialize_destroy_multiple_test.cpp index df51f5d94..337923b15 100644 --- a/source/tests/metacall_initialize_destroy_multiple_test/source/metacall_initialize_destroy_multiple_test.cpp +++ b/source/tests/metacall_initialize_destroy_multiple_test/source/metacall_initialize_destroy_multiple_test.cpp @@ -51,13 +51,13 @@ TEST_F(metacall_initialize_destroy_multiple_test, DefaultConstructor) ASSERT_EQ((int)0, (int)metacall_is_initialized(tag)); - ASSERT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); ASSERT_EQ((int)1, (int)metacall_is_initialized(tag)); } #endif /* OPTION_BUILD_LOADERS_MOCK */ - ASSERT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); - ASSERT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_initialize_ex_test/source/metacall_initialize_ex_test.cpp b/source/tests/metacall_initialize_ex_test/source/metacall_initialize_ex_test.cpp index 8c9e2930b..c26f24374 100644 --- a/source/tests/metacall_initialize_ex_test/source/metacall_initialize_ex_test.cpp +++ b/source/tests/metacall_initialize_ex_test/source/metacall_initialize_ex_test.cpp @@ -61,5 +61,5 @@ TEST_F(metacall_initialize_ex_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_MOCK */ - ASSERT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_initialize_test/source/metacall_initialize_test.cpp b/source/tests/metacall_initialize_test/source/metacall_initialize_test.cpp index ba4ab42b9..e1b67c480 100644 --- a/source/tests/metacall_initialize_test/source/metacall_initialize_test.cpp +++ b/source/tests/metacall_initialize_test/source/metacall_initialize_test.cpp @@ -49,5 +49,5 @@ TEST_F(metacall_initialize_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_MOCK */ - ASSERT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_inspect_test/source/metacall_inspect_test.cpp b/source/tests/metacall_inspect_test/source/metacall_inspect_test.cpp index 06b1c220b..a759571d7 100644 --- a/source/tests/metacall_inspect_test/source/metacall_inspect_test.cpp +++ b/source/tests/metacall_inspect_test/source/metacall_inspect_test.cpp @@ -134,5 +134,5 @@ TEST_F(metacall_inspect_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_integration_test/source/environment.cpp b/source/tests/metacall_integration_test/source/environment.cpp index 8ac160cf2..3c2a0bb9a 100644 --- a/source/tests/metacall_integration_test/source/environment.cpp +++ b/source/tests/metacall_integration_test/source/environment.cpp @@ -36,5 +36,5 @@ void environment::SetUp() void environment::TearDown() { - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_invalid_loader_test/source/metacall_invalid_loader_test.cpp b/source/tests/metacall_invalid_loader_test/source/metacall_invalid_loader_test.cpp index 92edc0f2d..dc472134f 100644 --- a/source/tests/metacall_invalid_loader_test/source/metacall_invalid_loader_test.cpp +++ b/source/tests/metacall_invalid_loader_test/source/metacall_invalid_loader_test.cpp @@ -48,5 +48,5 @@ TEST_F(metacall_invalid_loader_test, DefaultConstructor) ASSERT_EQ((int)1, (int)metacall_is_initialized("invalid")); - ASSERT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_java_test/source/metacall_java_test.cpp b/source/tests/metacall_java_test/source/metacall_java_test.cpp index c934cd173..d6a44287c 100644 --- a/source/tests/metacall_java_test/source/metacall_java_test.cpp +++ b/source/tests/metacall_java_test/source/metacall_java_test.cpp @@ -412,5 +412,5 @@ TEST_F(metacall_java_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_julia_test/source/metacall_julia_test.cpp b/source/tests/metacall_julia_test/source/metacall_julia_test.cpp index 1b9e21cdf..384ea1ec5 100644 --- a/source/tests/metacall_julia_test/source/metacall_julia_test.cpp +++ b/source/tests/metacall_julia_test/source/metacall_julia_test.cpp @@ -98,5 +98,5 @@ TEST_F(metacall_julia_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_library_path_without_env_vars_test/source/metacall_library_path_without_env_vars_test.cpp b/source/tests/metacall_library_path_without_env_vars_test/source/metacall_library_path_without_env_vars_test.cpp index a64b4464c..dade10d5e 100644 --- a/source/tests/metacall_library_path_without_env_vars_test/source/metacall_library_path_without_env_vars_test.cpp +++ b/source/tests/metacall_library_path_without_env_vars_test/source/metacall_library_path_without_env_vars_test.cpp @@ -45,5 +45,5 @@ TEST_F(metacall_library_path_without_env_vars_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_MOCK */ - ASSERT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_llvm_test/source/metacall_llvm_test.cpp b/source/tests/metacall_llvm_test/source/metacall_llvm_test.cpp index 446161e60..8d0100c17 100644 --- a/source/tests/metacall_llvm_test/source/metacall_llvm_test.cpp +++ b/source/tests/metacall_llvm_test/source/metacall_llvm_test.cpp @@ -99,5 +99,5 @@ TEST_F(metacall_llvm_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_load_configuration_fail_test/source/metacall_load_configuration_fail_test.cpp b/source/tests/metacall_load_configuration_fail_test/source/metacall_load_configuration_fail_test.cpp index 8632cb274..cdd57d852 100644 --- a/source/tests/metacall_load_configuration_fail_test/source/metacall_load_configuration_fail_test.cpp +++ b/source/tests/metacall_load_configuration_fail_test/source/metacall_load_configuration_fail_test.cpp @@ -72,5 +72,5 @@ TEST_F(metacall_load_configuration_fail_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_load_configuration_node_python_test/source/metacall_load_configuration_node_python_test.cpp b/source/tests/metacall_load_configuration_node_python_test/source/metacall_load_configuration_node_python_test.cpp index 92a253b9a..b9665efec 100644 --- a/source/tests/metacall_load_configuration_node_python_test/source/metacall_load_configuration_node_python_test.cpp +++ b/source/tests/metacall_load_configuration_node_python_test/source/metacall_load_configuration_node_python_test.cpp @@ -55,5 +55,5 @@ TEST_F(metacall_load_configuration_node_python_test, DefaultConstructor) EXPECT_EQ((double)5.0, (double)metacall_value_to_double(ret)); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_load_configuration_python_node_test/source/metacall_load_configuration_python_node_test.cpp b/source/tests/metacall_load_configuration_python_node_test/source/metacall_load_configuration_python_node_test.cpp index ae64810d4..005ee1e33 100644 --- a/source/tests/metacall_load_configuration_python_node_test/source/metacall_load_configuration_python_node_test.cpp +++ b/source/tests/metacall_load_configuration_python_node_test/source/metacall_load_configuration_python_node_test.cpp @@ -62,5 +62,5 @@ TEST_F(metacall_load_configuration_python_node_test, DefaultConstructor) metacall_allocator_destroy(config_allocator); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_load_configuration_relative_test/source/metacall_load_configuration_relative_test.cpp b/source/tests/metacall_load_configuration_relative_test/source/metacall_load_configuration_relative_test.cpp index c14a1ceda..7527de857 100644 --- a/source/tests/metacall_load_configuration_relative_test/source/metacall_load_configuration_relative_test.cpp +++ b/source/tests/metacall_load_configuration_relative_test/source/metacall_load_configuration_relative_test.cpp @@ -65,5 +65,5 @@ TEST_F(metacall_load_configuration_relative_test, DefaultConstructor) metacall_allocator_destroy(config_allocator); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_load_configuration_test/source/metacall_load_configuration_test.cpp b/source/tests/metacall_load_configuration_test/source/metacall_load_configuration_test.cpp index d3fc377c4..da91461a7 100644 --- a/source/tests/metacall_load_configuration_test/source/metacall_load_configuration_test.cpp +++ b/source/tests/metacall_load_configuration_test/source/metacall_load_configuration_test.cpp @@ -254,5 +254,5 @@ TEST_F(metacall_load_configuration_test, DefaultConstructor) metacall_allocator_destroy(config_allocator); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_load_memory_empty_test/source/metacall_load_memory_empty_test.cpp b/source/tests/metacall_load_memory_empty_test/source/metacall_load_memory_empty_test.cpp index ee424fed8..d00723446 100644 --- a/source/tests/metacall_load_memory_empty_test/source/metacall_load_memory_empty_test.cpp +++ b/source/tests/metacall_load_memory_empty_test/source/metacall_load_memory_empty_test.cpp @@ -67,5 +67,5 @@ TEST_F(metacall_load_memory_empty_test, DefaultConstructor) /* Non existent loader */ ASSERT_EQ((int)1, (int)metacall_load_from_memory("asdfghjk", buffer, sizeof(buffer), NULL)); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_load_memory_test/source/metacall_load_memory_test.cpp b/source/tests/metacall_load_memory_test/source/metacall_load_memory_test.cpp index b65eeb92e..1201ddaa4 100644 --- a/source/tests/metacall_load_memory_test/source/metacall_load_memory_test.cpp +++ b/source/tests/metacall_load_memory_test/source/metacall_load_memory_test.cpp @@ -157,5 +157,5 @@ TEST_F(metacall_load_memory_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_JS */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_logs_test/source/metacall_logs_test.cpp b/source/tests/metacall_logs_test/source/metacall_logs_test.cpp index 15c14c4ce..9c352db70 100644 --- a/source/tests/metacall_logs_test/source/metacall_logs_test.cpp +++ b/source/tests/metacall_logs_test/source/metacall_logs_test.cpp @@ -40,5 +40,5 @@ TEST_F(metacall_logs_test, DefaultConstructor) ASSERT_EQ((int)0, (int)metacall_initialize()); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_lua_test/source/metacall_lua_test.cpp b/source/tests/metacall_lua_test/source/metacall_lua_test.cpp index e229265f7..50baf66e3 100644 --- a/source/tests/metacall_lua_test/source/metacall_lua_test.cpp +++ b/source/tests/metacall_lua_test/source/metacall_lua_test.cpp @@ -110,5 +110,5 @@ TEST_F(metacall_lua_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_map_await_test/source/metacall_map_await_test.cpp b/source/tests/metacall_map_await_test/source/metacall_map_await_test.cpp index 8c3646f92..11243d861 100644 --- a/source/tests/metacall_map_await_test/source/metacall_map_await_test.cpp +++ b/source/tests/metacall_map_await_test/source/metacall_map_await_test.cpp @@ -263,7 +263,7 @@ TEST_F(metacall_map_await_test, DefaultConstructor) metacall_allocator_destroy(allocator); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); /* NodeJS */ #if defined(OPTION_BUILD_LOADERS_NODE) diff --git a/source/tests/metacall_map_test/source/metacall_map_test.cpp b/source/tests/metacall_map_test/source/metacall_map_test.cpp index ceb829c78..5aceb11fd 100644 --- a/source/tests/metacall_map_test/source/metacall_map_test.cpp +++ b/source/tests/metacall_map_test/source/metacall_map_test.cpp @@ -210,5 +210,5 @@ TEST_F(metacall_map_test, DefaultConstructor) metacall_allocator_destroy(allocator); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_async_multiple_test/source/metacall_node_async_multiple_test.cpp b/source/tests/metacall_node_async_multiple_test/source/metacall_node_async_multiple_test.cpp index 629b1c789..db398273c 100644 --- a/source/tests/metacall_node_async_multiple_test/source/metacall_node_async_multiple_test.cpp +++ b/source/tests/metacall_node_async_multiple_test/source/metacall_node_async_multiple_test.cpp @@ -198,7 +198,7 @@ TEST_F(metacall_node_async_multiple_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); /* NodeJS */ #if defined(OPTION_BUILD_LOADERS_NODE) diff --git a/source/tests/metacall_node_async_resources_test/source/metacall_node_async_resources_test.cpp b/source/tests/metacall_node_async_resources_test/source/metacall_node_async_resources_test.cpp index 4a979174e..dc256cc03 100644 --- a/source/tests/metacall_node_async_resources_test/source/metacall_node_async_resources_test.cpp +++ b/source/tests/metacall_node_async_resources_test/source/metacall_node_async_resources_test.cpp @@ -46,5 +46,5 @@ TEST_F(metacall_node_event_loop_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_async_test/source/metacall_node_async_test.cpp b/source/tests/metacall_node_async_test/source/metacall_node_async_test.cpp index 8c125563f..51c0843a5 100644 --- a/source/tests/metacall_node_async_test/source/metacall_node_async_test.cpp +++ b/source/tests/metacall_node_async_test/source/metacall_node_async_test.cpp @@ -252,7 +252,7 @@ TEST_F(metacall_node_async_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); /* NodeJS */ #if defined(OPTION_BUILD_LOADERS_NODE) diff --git a/source/tests/metacall_node_await_chain_test/source/metacall_node_await_chain_test.cpp b/source/tests/metacall_node_await_chain_test/source/metacall_node_await_chain_test.cpp index 308dff2bf..bf57f21f5 100644 --- a/source/tests/metacall_node_await_chain_test/source/metacall_node_await_chain_test.cpp +++ b/source/tests/metacall_node_await_chain_test/source/metacall_node_await_chain_test.cpp @@ -95,7 +95,7 @@ TEST_F(metacall_node_await_chain_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); EXPECT_EQ((unsigned int)3, (unsigned int)callbacks_executed); } diff --git a/source/tests/metacall_node_call_test/source/metacall_node_call_test.cpp b/source/tests/metacall_node_call_test/source/metacall_node_call_test.cpp index 7d1fbd59a..3608330ee 100644 --- a/source/tests/metacall_node_call_test/source/metacall_node_call_test.cpp +++ b/source/tests/metacall_node_call_test/source/metacall_node_call_test.cpp @@ -67,5 +67,5 @@ TEST_F(metacall_node_call_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_callback_test/source/metacall_node_callback_test.cpp b/source/tests/metacall_node_callback_test/source/metacall_node_callback_test.cpp index a8a4bd900..f89070ac2 100644 --- a/source/tests/metacall_node_callback_test/source/metacall_node_callback_test.cpp +++ b/source/tests/metacall_node_callback_test/source/metacall_node_callback_test.cpp @@ -66,5 +66,5 @@ TEST_F(metacall_node_callback_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_clear_mem_test/source/metacall_node_clear_mem_test.cpp b/source/tests/metacall_node_clear_mem_test/source/metacall_node_clear_mem_test.cpp index 17e38ea18..713933581 100644 --- a/source/tests/metacall_node_clear_mem_test/source/metacall_node_clear_mem_test.cpp +++ b/source/tests/metacall_node_clear_mem_test/source/metacall_node_clear_mem_test.cpp @@ -64,5 +64,5 @@ TEST_F(metacall_node_clear_mem_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_default_export_test/source/metacall_node_default_export_test.cpp b/source/tests/metacall_node_default_export_test/source/metacall_node_default_export_test.cpp index 6e51c13c1..ac9bd4bd2 100644 --- a/source/tests/metacall_node_default_export_test/source/metacall_node_default_export_test.cpp +++ b/source/tests/metacall_node_default_export_test/source/metacall_node_default_export_test.cpp @@ -83,5 +83,5 @@ TEST_F(metacall_node_default_export_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_event_loop_signal_test/source/metacall_node_event_loop_signal_test.cpp b/source/tests/metacall_node_event_loop_signal_test/source/metacall_node_event_loop_signal_test.cpp index 5cf2feeb3..463aabc6b 100644 --- a/source/tests/metacall_node_event_loop_signal_test/source/metacall_node_event_loop_signal_test.cpp +++ b/source/tests/metacall_node_event_loop_signal_test/source/metacall_node_event_loop_signal_test.cpp @@ -54,5 +54,5 @@ TEST_F(metacall_node_event_loop_signal_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_event_loop_test/source/metacall_node_event_loop_test.cpp b/source/tests/metacall_node_event_loop_test/source/metacall_node_event_loop_test.cpp index 350386b0c..88e019798 100644 --- a/source/tests/metacall_node_event_loop_test/source/metacall_node_event_loop_test.cpp +++ b/source/tests/metacall_node_event_loop_test/source/metacall_node_event_loop_test.cpp @@ -46,5 +46,5 @@ TEST_F(metacall_node_event_loop_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_exception_test/source/metacall_node_exception_test.cpp b/source/tests/metacall_node_exception_test/source/metacall_node_exception_test.cpp index a82a9ed6c..794056a01 100644 --- a/source/tests/metacall_node_exception_test/source/metacall_node_exception_test.cpp +++ b/source/tests/metacall_node_exception_test/source/metacall_node_exception_test.cpp @@ -75,5 +75,5 @@ TEST_F(metacall_node_exception_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_extension_test/source/metacall_node_extension_test.cpp b/source/tests/metacall_node_extension_test/source/metacall_node_extension_test.cpp index f091bf53c..6514b0c75 100644 --- a/source/tests/metacall_node_extension_test/source/metacall_node_extension_test.cpp +++ b/source/tests/metacall_node_extension_test/source/metacall_node_extension_test.cpp @@ -79,5 +79,5 @@ TEST_F(metacall_node_extension_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_fail_env_var_test/source/metacall_node_fail_env_var_test.cpp b/source/tests/metacall_node_fail_env_var_test/source/metacall_node_fail_env_var_test.cpp index 6c3e0f255..5803e2920 100644 --- a/source/tests/metacall_node_fail_env_var_test/source/metacall_node_fail_env_var_test.cpp +++ b/source/tests/metacall_node_fail_env_var_test/source/metacall_node_fail_env_var_test.cpp @@ -66,5 +66,5 @@ TEST_F(metacall_node_fail_env_var_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_fail_load_leak_test/source/metacall_node_fail_load_leak_test.cpp b/source/tests/metacall_node_fail_load_leak_test/source/metacall_node_fail_load_leak_test.cpp index a9c44e1f6..b99d94d2b 100644 --- a/source/tests/metacall_node_fail_load_leak_test/source/metacall_node_fail_load_leak_test.cpp +++ b/source/tests/metacall_node_fail_load_leak_test/source/metacall_node_fail_load_leak_test.cpp @@ -70,5 +70,5 @@ TEST_F(metacall_node_fail_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_fail_test/source/metacall_node_fail_test.cpp b/source/tests/metacall_node_fail_test/source/metacall_node_fail_test.cpp index d065434d0..5b1038755 100644 --- a/source/tests/metacall_node_fail_test/source/metacall_node_fail_test.cpp +++ b/source/tests/metacall_node_fail_test/source/metacall_node_fail_test.cpp @@ -71,5 +71,5 @@ TEST_F(metacall_node_fail_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_inline_test/source/metacall_node_inline_test.cpp b/source/tests/metacall_node_inline_test/source/metacall_node_inline_test.cpp index c8f9f767c..4148ae1fb 100644 --- a/source/tests/metacall_node_inline_test/source/metacall_node_inline_test.cpp +++ b/source/tests/metacall_node_inline_test/source/metacall_node_inline_test.cpp @@ -81,5 +81,5 @@ TEST_F(metacall_node_inline_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_multithread_deadlock_test/source/metacall_node_multithread_deadlock_test.cpp b/source/tests/metacall_node_multithread_deadlock_test/source/metacall_node_multithread_deadlock_test.cpp index d1b33518e..133d949dd 100644 --- a/source/tests/metacall_node_multithread_deadlock_test/source/metacall_node_multithread_deadlock_test.cpp +++ b/source/tests/metacall_node_multithread_deadlock_test/source/metacall_node_multithread_deadlock_test.cpp @@ -125,7 +125,7 @@ TEST_F(metacall_node_multithread_deadlock_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); /* NodeJS */ #if defined(OPTION_BUILD_LOADERS_NODE) diff --git a/source/tests/metacall_node_native_code_test/source/metacall_node_native_code_test.cpp b/source/tests/metacall_node_native_code_test/source/metacall_node_native_code_test.cpp index 83bd3466b..bbf7fcf5d 100644 --- a/source/tests/metacall_node_native_code_test/source/metacall_node_native_code_test.cpp +++ b/source/tests/metacall_node_native_code_test/source/metacall_node_native_code_test.cpp @@ -68,5 +68,5 @@ TEST_F(metacall_node_unsupported_features_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_port_await_test/source/metacall_node_port_await_test.cpp b/source/tests/metacall_node_port_await_test/source/metacall_node_port_await_test.cpp index 34d49f16e..00766eb88 100644 --- a/source/tests/metacall_node_port_await_test/source/metacall_node_port_await_test.cpp +++ b/source/tests/metacall_node_port_await_test/source/metacall_node_port_await_test.cpp @@ -71,5 +71,5 @@ TEST_F(metacall_node_port_await_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_port_rs_test/source/metacall_node_port_rs_test.cpp b/source/tests/metacall_node_port_rs_test/source/metacall_node_port_rs_test.cpp index 3c34a8094..4c57bb201 100644 --- a/source/tests/metacall_node_port_rs_test/source/metacall_node_port_rs_test.cpp +++ b/source/tests/metacall_node_port_rs_test/source/metacall_node_port_rs_test.cpp @@ -55,5 +55,5 @@ TEST_F(metacall_node_port_rs_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE && OPTION_BUILD_LOADERS_RS */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_port_test/source/metacall_node_port_test.cpp b/source/tests/metacall_node_port_test/source/metacall_node_port_test.cpp index 3b3552186..5cfb285a2 100644 --- a/source/tests/metacall_node_port_test/source/metacall_node_port_test.cpp +++ b/source/tests/metacall_node_port_test/source/metacall_node_port_test.cpp @@ -85,5 +85,5 @@ TEST_F(metacall_node_port_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_python_async_after_destroy_test/source/metacall_node_python_async_after_destroy_test.cpp b/source/tests/metacall_node_python_async_after_destroy_test/source/metacall_node_python_async_after_destroy_test.cpp index 464e9b750..43cdbde33 100644 --- a/source/tests/metacall_node_python_async_after_destroy_test/source/metacall_node_python_async_after_destroy_test.cpp +++ b/source/tests/metacall_node_python_async_after_destroy_test/source/metacall_node_python_async_after_destroy_test.cpp @@ -65,5 +65,5 @@ TEST_F(metacall_node_python_async_after_destroy_test, DefaultConstructor) * https://github.com/metacall/core/commit/9b64ee533079fa0d543fc346fb7149d1086451f0 * https://github.com/metacall/core/commit/22bd999c281f23aac04cea7df435a836631706da */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_python_await_extended_test/source/metacall_node_python_await_extended_test.cpp b/source/tests/metacall_node_python_await_extended_test/source/metacall_node_python_await_extended_test.cpp index ef20b69f4..57e9c143b 100644 --- a/source/tests/metacall_node_python_await_extended_test/source/metacall_node_python_await_extended_test.cpp +++ b/source/tests/metacall_node_python_await_extended_test/source/metacall_node_python_await_extended_test.cpp @@ -90,5 +90,5 @@ TEST_F(metacall_node_python_await_extended_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE && OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_python_await_test/source/metacall_node_python_await_test.cpp b/source/tests/metacall_node_python_await_test/source/metacall_node_python_await_test.cpp index 2f7160c5d..b140752ac 100644 --- a/source/tests/metacall_node_python_await_test/source/metacall_node_python_await_test.cpp +++ b/source/tests/metacall_node_python_await_test/source/metacall_node_python_await_test.cpp @@ -84,5 +84,5 @@ TEST_F(metacall_node_python_await_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE && OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_python_deadlock_test/source/metacall_node_python_deadlock_test.cpp b/source/tests/metacall_node_python_deadlock_test/source/metacall_node_python_deadlock_test.cpp index 95c5f2d9b..4b9ce4866 100644 --- a/source/tests/metacall_node_python_deadlock_test/source/metacall_node_python_deadlock_test.cpp +++ b/source/tests/metacall_node_python_deadlock_test/source/metacall_node_python_deadlock_test.cpp @@ -54,5 +54,5 @@ TEST_F(metacall_node_python_deadlock_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE && OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_python_exception_test/source/metacall_node_python_exception_test.cpp b/source/tests/metacall_node_python_exception_test/source/metacall_node_python_exception_test.cpp index abe3e4a49..69ed55884 100644 --- a/source/tests/metacall_node_python_exception_test/source/metacall_node_python_exception_test.cpp +++ b/source/tests/metacall_node_python_exception_test/source/metacall_node_python_exception_test.cpp @@ -59,5 +59,5 @@ TEST_F(metacall_node_python_exception_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE && OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_python_port_mock_test/source/metacall_node_python_port_mock_test.cpp b/source/tests/metacall_node_python_port_mock_test/source/metacall_node_python_port_mock_test.cpp index c1db00da3..7670e8d89 100644 --- a/source/tests/metacall_node_python_port_mock_test/source/metacall_node_python_port_mock_test.cpp +++ b/source/tests/metacall_node_python_port_mock_test/source/metacall_node_python_port_mock_test.cpp @@ -64,5 +64,5 @@ TEST_F(metacall_node_python_port_mock_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE && OPTION_BUILD_LOADERS_PY && OPTION_BUILD_LOADERS_MOCK */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_python_port_ruby_test/source/metacall_node_python_port_ruby_test.cpp b/source/tests/metacall_node_python_port_ruby_test/source/metacall_node_python_port_ruby_test.cpp index 87ce31cb0..0b4edc45c 100644 --- a/source/tests/metacall_node_python_port_ruby_test/source/metacall_node_python_port_ruby_test.cpp +++ b/source/tests/metacall_node_python_port_ruby_test/source/metacall_node_python_port_ruby_test.cpp @@ -59,5 +59,5 @@ TEST_F(metacall_node_python_port_ruby_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE && OPTION_BUILD_LOADERS_PY && OPTION_BUILD_LOADERS_RB */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_python_ruby_test/source/metacall_node_python_ruby_test.cpp b/source/tests/metacall_node_python_ruby_test/source/metacall_node_python_ruby_test.cpp index 246e93b8a..a3ff9fe7e 100644 --- a/source/tests/metacall_node_python_ruby_test/source/metacall_node_python_ruby_test.cpp +++ b/source/tests/metacall_node_python_ruby_test/source/metacall_node_python_ruby_test.cpp @@ -110,5 +110,5 @@ TEST_F(metacall_node_python_ruby_test, DefaultConstructor) EXPECT_EQ((int)success_callbacks, (int)1); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_reentrant_test/source/metacall_node_reentrant_test.cpp b/source/tests/metacall_node_reentrant_test/source/metacall_node_reentrant_test.cpp index 2f32965ec..cfac3514f 100644 --- a/source/tests/metacall_node_reentrant_test/source/metacall_node_reentrant_test.cpp +++ b/source/tests/metacall_node_reentrant_test/source/metacall_node_reentrant_test.cpp @@ -119,5 +119,5 @@ TEST_F(metacall_node_reentrant_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_signal_handler_test/source/metacall_node_signal_handler_test.cpp b/source/tests/metacall_node_signal_handler_test/source/metacall_node_signal_handler_test.cpp index 8dd995d8d..869a6fd1e 100644 --- a/source/tests/metacall_node_signal_handler_test/source/metacall_node_signal_handler_test.cpp +++ b/source/tests/metacall_node_signal_handler_test/source/metacall_node_signal_handler_test.cpp @@ -127,7 +127,7 @@ TEST_F(metacall_node_signal_handler_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); EXPECT_EQ((bool)callback_result.load(), (bool)true); EXPECT_EQ((bool)signal_result.load(), (bool)true); diff --git a/source/tests/metacall_node_test/source/metacall_node_test.cpp b/source/tests/metacall_node_test/source/metacall_node_test.cpp index 1b7b595b6..f63f67c2c 100644 --- a/source/tests/metacall_node_test/source/metacall_node_test.cpp +++ b/source/tests/metacall_node_test/source/metacall_node_test.cpp @@ -143,5 +143,5 @@ TEST_F(metacall_node_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_node_typescript_test/source/metacall_node_typescript_test.cpp b/source/tests/metacall_node_typescript_test/source/metacall_node_typescript_test.cpp index 49ddae7f9..984705f86 100644 --- a/source/tests/metacall_node_typescript_test/source/metacall_node_typescript_test.cpp +++ b/source/tests/metacall_node_typescript_test/source/metacall_node_typescript_test.cpp @@ -138,5 +138,5 @@ TEST_F(metacall_node_typescript_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_plugin_extension_destroy_order_test/source/metacall_plugin_extension_destroy_order_test.cpp b/source/tests/metacall_plugin_extension_destroy_order_test/source/metacall_plugin_extension_destroy_order_test.cpp index d738fa05a..0ad0838ab 100644 --- a/source/tests/metacall_plugin_extension_destroy_order_test/source/metacall_plugin_extension_destroy_order_test.cpp +++ b/source/tests/metacall_plugin_extension_destroy_order_test/source/metacall_plugin_extension_destroy_order_test.cpp @@ -77,5 +77,5 @@ TEST_F(metacall_plugin_destroy_order_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_plugin_extension_invalid_path_test/source/metacall_plugin_extension_invalid_path_test.cpp b/source/tests/metacall_plugin_extension_invalid_path_test/source/metacall_plugin_extension_invalid_path_test.cpp index 56731f996..fe30dd53e 100644 --- a/source/tests/metacall_plugin_extension_invalid_path_test/source/metacall_plugin_extension_invalid_path_test.cpp +++ b/source/tests/metacall_plugin_extension_invalid_path_test/source/metacall_plugin_extension_invalid_path_test.cpp @@ -77,5 +77,5 @@ TEST_F(metacall_plugin_extension_invalid_path_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_plugin_extension_local_test/source/metacall_plugin_extension_local_test.cpp b/source/tests/metacall_plugin_extension_local_test/source/metacall_plugin_extension_local_test.cpp index cb49d030b..b7a6680f6 100644 --- a/source/tests/metacall_plugin_extension_local_test/source/metacall_plugin_extension_local_test.cpp +++ b/source/tests/metacall_plugin_extension_local_test/source/metacall_plugin_extension_local_test.cpp @@ -119,5 +119,5 @@ TEST_F(metacall_plugin_extension_local_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_plugin_extension_test/source/metacall_plugin_extension_test.cpp b/source/tests/metacall_plugin_extension_test/source/metacall_plugin_extension_test.cpp index 73a726997..975e70590 100644 --- a/source/tests/metacall_plugin_extension_test/source/metacall_plugin_extension_test.cpp +++ b/source/tests/metacall_plugin_extension_test/source/metacall_plugin_extension_test.cpp @@ -117,5 +117,5 @@ TEST_F(metacall_plugin_extension_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_async_test/source/metacall_python_async_test.cpp b/source/tests/metacall_python_async_test/source/metacall_python_async_test.cpp index 2b5680982..736753c3d 100644 --- a/source/tests/metacall_python_async_test/source/metacall_python_async_test.cpp +++ b/source/tests/metacall_python_async_test/source/metacall_python_async_test.cpp @@ -160,5 +160,5 @@ TEST_F(metacall_python_async_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_await_test/source/metacall_python_await_test.cpp b/source/tests/metacall_python_await_test/source/metacall_python_await_test.cpp index 79d1a7d47..355e71288 100644 --- a/source/tests/metacall_python_await_test/source/metacall_python_await_test.cpp +++ b/source/tests/metacall_python_await_test/source/metacall_python_await_test.cpp @@ -68,5 +68,5 @@ TEST_F(metacall_python_await_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_builtins_test/source/metacall_python_builtins_test.cpp b/source/tests/metacall_python_builtins_test/source/metacall_python_builtins_test.cpp index e3fb30711..5ba74c839 100644 --- a/source/tests/metacall_python_builtins_test/source/metacall_python_builtins_test.cpp +++ b/source/tests/metacall_python_builtins_test/source/metacall_python_builtins_test.cpp @@ -77,5 +77,5 @@ TEST_F(metacall_python_builtins_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_callback_test/source/metacall_python_callback_test.cpp b/source/tests/metacall_python_callback_test/source/metacall_python_callback_test.cpp index c183c575e..b62c2d021 100644 --- a/source/tests/metacall_python_callback_test/source/metacall_python_callback_test.cpp +++ b/source/tests/metacall_python_callback_test/source/metacall_python_callback_test.cpp @@ -66,5 +66,5 @@ TEST_F(metacall_python_callback_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_dict_test/source/metacall_python_dict_test.cpp b/source/tests/metacall_python_dict_test/source/metacall_python_dict_test.cpp index af0ec1aa5..b5cb079b9 100644 --- a/source/tests/metacall_python_dict_test/source/metacall_python_dict_test.cpp +++ b/source/tests/metacall_python_dict_test/source/metacall_python_dict_test.cpp @@ -169,5 +169,5 @@ TEST_F(metacall_python_dict_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_exception_test/source/metacall_python_exception_test.cpp b/source/tests/metacall_python_exception_test/source/metacall_python_exception_test.cpp index 1a5f92cec..05726d9a4 100644 --- a/source/tests/metacall_python_exception_test/source/metacall_python_exception_test.cpp +++ b/source/tests/metacall_python_exception_test/source/metacall_python_exception_test.cpp @@ -72,5 +72,5 @@ TEST_F(metacall_python_exception_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_fail_test/source/metacall_python_fail_test.cpp b/source/tests/metacall_python_fail_test/source/metacall_python_fail_test.cpp index b36822b37..f35f187b8 100644 --- a/source/tests/metacall_python_fail_test/source/metacall_python_fail_test.cpp +++ b/source/tests/metacall_python_fail_test/source/metacall_python_fail_test.cpp @@ -93,5 +93,5 @@ TEST_F(metacall_python_fail_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_gc_test/source/metacall_python_gc_test.cpp b/source/tests/metacall_python_gc_test/source/metacall_python_gc_test.cpp index 14e5fdc74..d7f1fc308 100644 --- a/source/tests/metacall_python_gc_test/source/metacall_python_gc_test.cpp +++ b/source/tests/metacall_python_gc_test/source/metacall_python_gc_test.cpp @@ -63,5 +63,5 @@ TEST_F(metacall_python_gc_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_loader_port_test/source/metacall_python_loader_port_test.cpp b/source/tests/metacall_python_loader_port_test/source/metacall_python_loader_port_test.cpp index 05619bf63..bc151f7d9 100644 --- a/source/tests/metacall_python_loader_port_test/source/metacall_python_loader_port_test.cpp +++ b/source/tests/metacall_python_loader_port_test/source/metacall_python_loader_port_test.cpp @@ -131,5 +131,5 @@ TEST_F(metacall_python_loader_port_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_model_test/source/metacall_python_model_test.cpp b/source/tests/metacall_python_model_test/source/metacall_python_model_test.cpp index 1ab58c5db..503e0f6c0 100644 --- a/source/tests/metacall_python_model_test/source/metacall_python_model_test.cpp +++ b/source/tests/metacall_python_model_test/source/metacall_python_model_test.cpp @@ -82,5 +82,5 @@ TEST_F(metacall_python_model_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_node_await_test/source/metacall_python_node_await_test.cpp b/source/tests/metacall_python_node_await_test/source/metacall_python_node_await_test.cpp index 5b1d15b30..219b8b4a6 100644 --- a/source/tests/metacall_python_node_await_test/source/metacall_python_node_await_test.cpp +++ b/source/tests/metacall_python_node_await_test/source/metacall_python_node_await_test.cpp @@ -71,5 +71,5 @@ TEST_F(metacall_python_node_await_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_NODE && OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_object_class_test/source/metacall_python_object_class_test.cpp b/source/tests/metacall_python_object_class_test/source/metacall_python_object_class_test.cpp index c2117aeb1..b1f6d18fb 100644 --- a/source/tests/metacall_python_object_class_test/source/metacall_python_object_class_test.cpp +++ b/source/tests/metacall_python_object_class_test/source/metacall_python_object_class_test.cpp @@ -203,5 +203,5 @@ TEST_F(metacall_python_class_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_open_test/source/metacall_python_open_test.cpp b/source/tests/metacall_python_open_test/source/metacall_python_open_test.cpp index 0a273681e..23b30971f 100644 --- a/source/tests/metacall_python_open_test/source/metacall_python_open_test.cpp +++ b/source/tests/metacall_python_open_test/source/metacall_python_open_test.cpp @@ -94,5 +94,5 @@ TEST_F(metacall_python_open_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_pointer_test/source/metacall_python_pointer_test.cpp b/source/tests/metacall_python_pointer_test/source/metacall_python_pointer_test.cpp index 863ab1cdd..93afe1d31 100644 --- a/source/tests/metacall_python_pointer_test/source/metacall_python_pointer_test.cpp +++ b/source/tests/metacall_python_pointer_test/source/metacall_python_pointer_test.cpp @@ -160,5 +160,5 @@ TEST_F(metacall_python_pointer_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_port_callback_test/source/metacall_python_port_callback_test.cpp b/source/tests/metacall_python_port_callback_test/source/metacall_python_port_callback_test.cpp index b3f5b8598..0cf39bfe3 100644 --- a/source/tests/metacall_python_port_callback_test/source/metacall_python_port_callback_test.cpp +++ b/source/tests/metacall_python_port_callback_test/source/metacall_python_port_callback_test.cpp @@ -67,5 +67,5 @@ TEST_F(metacall_python_port_callback_test, DefaultConstructor) metacall_value_destroy(ret); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_port_https_test/source/metacall_python_port_https_test.cpp b/source/tests/metacall_python_port_https_test/source/metacall_python_port_https_test.cpp index f552efa14..b005ffa1b 100644 --- a/source/tests/metacall_python_port_https_test/source/metacall_python_port_https_test.cpp +++ b/source/tests/metacall_python_port_https_test/source/metacall_python_port_https_test.cpp @@ -71,5 +71,5 @@ TEST_F(metacall_python_port_https_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_port_import_test/source/metacall_python_port_import_test.cpp b/source/tests/metacall_python_port_import_test/source/metacall_python_port_import_test.cpp index bfb2fa4e8..0b15fa977 100644 --- a/source/tests/metacall_python_port_import_test/source/metacall_python_port_import_test.cpp +++ b/source/tests/metacall_python_port_import_test/source/metacall_python_port_import_test.cpp @@ -118,5 +118,5 @@ TEST_F(metacall_python_port_import_test, metacall_node_ramda_case_1) ASSERT_NE((void *)handle, (void *)NULL); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_port_pointer_test/source/metacall_python_port_pointer_test.cpp b/source/tests/metacall_python_port_pointer_test/source/metacall_python_port_pointer_test.cpp index b2d57db4b..2e48f5607 100644 --- a/source/tests/metacall_python_port_pointer_test/source/metacall_python_port_pointer_test.cpp +++ b/source/tests/metacall_python_port_pointer_test/source/metacall_python_port_pointer_test.cpp @@ -118,5 +118,5 @@ TEST_F(metacall_python_port_pointer_test, DefaultConstructor) metacall_value_destroy(ret); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_port_test/source/metacall_python_port_test.cpp b/source/tests/metacall_python_port_test/source/metacall_python_port_test.cpp index e901d7245..d562fd89e 100644 --- a/source/tests/metacall_python_port_test/source/metacall_python_port_test.cpp +++ b/source/tests/metacall_python_port_test/source/metacall_python_port_test.cpp @@ -52,5 +52,5 @@ TEST_F(metacall_python_port_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_reentrant_test/source/metacall_python_reentrant_test.cpp b/source/tests/metacall_python_reentrant_test/source/metacall_python_reentrant_test.cpp index 33328a637..fa6dae3f6 100644 --- a/source/tests/metacall_python_reentrant_test/source/metacall_python_reentrant_test.cpp +++ b/source/tests/metacall_python_reentrant_test/source/metacall_python_reentrant_test.cpp @@ -76,5 +76,5 @@ TEST_F(metacall_python_reentrant_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_relative_path_test/source/metacall_python_relative_path_test.cpp b/source/tests/metacall_python_relative_path_test/source/metacall_python_relative_path_test.cpp index 5d0505a56..f1f7ce4bb 100644 --- a/source/tests/metacall_python_relative_path_test/source/metacall_python_relative_path_test.cpp +++ b/source/tests/metacall_python_relative_path_test/source/metacall_python_relative_path_test.cpp @@ -72,5 +72,5 @@ TEST_F(metacall_python_dict_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_test/source/metacall_python_test.cpp b/source/tests/metacall_python_test/source/metacall_python_test.cpp index 97a6bb3ef..35dfb9e41 100644 --- a/source/tests/metacall_python_test/source/metacall_python_test.cpp +++ b/source/tests/metacall_python_test/source/metacall_python_test.cpp @@ -77,5 +77,5 @@ TEST_F(metacall_python_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_varargs_test/source/metacall_python_varargs_test.cpp b/source/tests/metacall_python_varargs_test/source/metacall_python_varargs_test.cpp index 539c7e02b..d5a2ee376 100644 --- a/source/tests/metacall_python_varargs_test/source/metacall_python_varargs_test.cpp +++ b/source/tests/metacall_python_varargs_test/source/metacall_python_varargs_test.cpp @@ -102,5 +102,5 @@ TEST_F(metacall_python_varargs_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_without_env_vars_test/source/metacall_python_without_env_vars_test.cpp b/source/tests/metacall_python_without_env_vars_test/source/metacall_python_without_env_vars_test.cpp index 7a0c6c118..9c35499a7 100644 --- a/source/tests/metacall_python_without_env_vars_test/source/metacall_python_without_env_vars_test.cpp +++ b/source/tests/metacall_python_without_env_vars_test/source/metacall_python_without_env_vars_test.cpp @@ -45,5 +45,5 @@ TEST_F(metacall_python_without_env_vars_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_PY */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_python_without_functions_test/source/metacall_python_without_functions_test.cpp b/source/tests/metacall_python_without_functions_test/source/metacall_python_without_functions_test.cpp index 8dd69eafa..7c4ec16a4 100644 --- a/source/tests/metacall_python_without_functions_test/source/metacall_python_without_functions_test.cpp +++ b/source/tests/metacall_python_without_functions_test/source/metacall_python_without_functions_test.cpp @@ -66,5 +66,5 @@ TEST_F(metacall_python_without_functions_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_reinitialize_test/source/metacall_reinitialize_test.cpp b/source/tests/metacall_reinitialize_test/source/metacall_reinitialize_test.cpp index e1324ba7f..d3cade323 100644 --- a/source/tests/metacall_reinitialize_test/source/metacall_reinitialize_test.cpp +++ b/source/tests/metacall_reinitialize_test/source/metacall_reinitialize_test.cpp @@ -61,6 +61,6 @@ TEST_F(metacall_reinitialize_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_MOCK */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } } diff --git a/source/tests/metacall_reload_functions_test/source/metacall_reload_functions_test.cpp b/source/tests/metacall_reload_functions_test/source/metacall_reload_functions_test.cpp index 85fee11c5..ae4bc3905 100644 --- a/source/tests/metacall_reload_functions_test/source/metacall_reload_functions_test.cpp +++ b/source/tests/metacall_reload_functions_test/source/metacall_reload_functions_test.cpp @@ -170,5 +170,5 @@ TEST_F(metacall_reload_functions_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_return_monad_test/source/metacall_return_monad_test.cpp b/source/tests/metacall_return_monad_test/source/metacall_return_monad_test.cpp index 63b65fe2f..ad07a1db8 100644 --- a/source/tests/metacall_return_monad_test/source/metacall_return_monad_test.cpp +++ b/source/tests/metacall_return_monad_test/source/metacall_return_monad_test.cpp @@ -129,5 +129,5 @@ TEST_F(metacall_return_monad_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_rpc_test/source/metacall_rpc_test.cpp b/source/tests/metacall_rpc_test/source/metacall_rpc_test.cpp index 0984befcd..51fb948f2 100644 --- a/source/tests/metacall_rpc_test/source/metacall_rpc_test.cpp +++ b/source/tests/metacall_rpc_test/source/metacall_rpc_test.cpp @@ -87,5 +87,5 @@ TEST_F(metacall_rpc_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_RPC */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_ruby_fail_empty_test/source/metacall_ruby_fail_empty_test.cpp b/source/tests/metacall_ruby_fail_empty_test/source/metacall_ruby_fail_empty_test.cpp index b9cb7dfd2..96b4f5c15 100644 --- a/source/tests/metacall_ruby_fail_empty_test/source/metacall_ruby_fail_empty_test.cpp +++ b/source/tests/metacall_ruby_fail_empty_test/source/metacall_ruby_fail_empty_test.cpp @@ -69,5 +69,5 @@ TEST_F(metacall_ruby_fail_empty_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_ruby_fail_test/source/metacall_ruby_fail_test.cpp b/source/tests/metacall_ruby_fail_test/source/metacall_ruby_fail_test.cpp index b7228a7e9..2fe3de533 100644 --- a/source/tests/metacall_ruby_fail_test/source/metacall_ruby_fail_test.cpp +++ b/source/tests/metacall_ruby_fail_test/source/metacall_ruby_fail_test.cpp @@ -50,5 +50,5 @@ TEST_F(metacall_ruby_fail_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_RB */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_ruby_object_class_test/source/metacall_ruby_object_class_test.cpp b/source/tests/metacall_ruby_object_class_test/source/metacall_ruby_object_class_test.cpp index ca8ca3c14..c471d2406 100644 --- a/source/tests/metacall_ruby_object_class_test/source/metacall_ruby_object_class_test.cpp +++ b/source/tests/metacall_ruby_object_class_test/source/metacall_ruby_object_class_test.cpp @@ -160,5 +160,5 @@ TEST_F(metacall_ruby_object_class_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_ruby_parser_integration_test/source/metacall_ruby_parser_integration_test.cpp b/source/tests/metacall_ruby_parser_integration_test/source/metacall_ruby_parser_integration_test.cpp index e9fd2d082..295697da2 100644 --- a/source/tests/metacall_ruby_parser_integration_test/source/metacall_ruby_parser_integration_test.cpp +++ b/source/tests/metacall_ruby_parser_integration_test/source/metacall_ruby_parser_integration_test.cpp @@ -80,5 +80,5 @@ TEST_F(metacall_ruby_parser_integration_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_RB */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_ruby_rails_integration_test/source/metacall_ruby_rails_integration_test.cpp b/source/tests/metacall_ruby_rails_integration_test/source/metacall_ruby_rails_integration_test.cpp index 91fb3fb4c..66b0fa747 100644 --- a/source/tests/metacall_ruby_rails_integration_test/source/metacall_ruby_rails_integration_test.cpp +++ b/source/tests/metacall_ruby_rails_integration_test/source/metacall_ruby_rails_integration_test.cpp @@ -59,5 +59,5 @@ TEST_F(metacall_ruby_integration_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_RB */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_ruby_test/source/metacall_ruby_test.cpp b/source/tests/metacall_ruby_test/source/metacall_ruby_test.cpp index e22eb5dbb..adb9a7007 100644 --- a/source/tests/metacall_ruby_test/source/metacall_ruby_test.cpp +++ b/source/tests/metacall_ruby_test/source/metacall_ruby_test.cpp @@ -37,5 +37,5 @@ TEST_F(metacall_ruby_test, DefaultConstructor) EXPECT_EQ((int)0, (int)metacall_load_from_file("rb", rb_scripts, sizeof(rb_scripts) / sizeof(rb_scripts[0]), NULL)); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_rust_class_test/source/metacall_rust_class_test.cpp b/source/tests/metacall_rust_class_test/source/metacall_rust_class_test.cpp index 64d4627bf..cb0c537a0 100644 --- a/source/tests/metacall_rust_class_test/source/metacall_rust_class_test.cpp +++ b/source/tests/metacall_rust_class_test/source/metacall_rust_class_test.cpp @@ -103,5 +103,5 @@ TEST_F(metacall_rust_class_test, DefaultConstructor) // metacall_value_destroy(book_class); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_rust_load_from_mem_test/source/metacall_rust_load_from_mem_test.cpp b/source/tests/metacall_rust_load_from_mem_test/source/metacall_rust_load_from_mem_test.cpp index fccdcee34..5a2f5b440 100644 --- a/source/tests/metacall_rust_load_from_mem_test/source/metacall_rust_load_from_mem_test.cpp +++ b/source/tests/metacall_rust_load_from_mem_test/source/metacall_rust_load_from_mem_test.cpp @@ -69,5 +69,5 @@ TEST_F(metacall_rust_load_from_mem_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_rust_load_from_package_class_test/source/metacall_rust_load_from_package_class_test.cpp b/source/tests/metacall_rust_load_from_package_class_test/source/metacall_rust_load_from_package_class_test.cpp index db6f6de38..6d6ed2bfc 100644 --- a/source/tests/metacall_rust_load_from_package_class_test/source/metacall_rust_load_from_package_class_test.cpp +++ b/source/tests/metacall_rust_load_from_package_class_test/source/metacall_rust_load_from_package_class_test.cpp @@ -102,5 +102,5 @@ TEST_F(metacall_rust_load_from_mem_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_rust_load_from_package_dep_test/source/metacall_rust_load_from_package_dep_test.cpp b/source/tests/metacall_rust_load_from_package_dep_test/source/metacall_rust_load_from_package_dep_test.cpp index c239fd1cc..dc578bb42 100644 --- a/source/tests/metacall_rust_load_from_package_dep_test/source/metacall_rust_load_from_package_dep_test.cpp +++ b/source/tests/metacall_rust_load_from_package_dep_test/source/metacall_rust_load_from_package_dep_test.cpp @@ -65,5 +65,5 @@ TEST_F(metacall_rust_load_from_package_dep_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_rust_load_from_package_test/source/metacall_rust_load_from_package_test.cpp b/source/tests/metacall_rust_load_from_package_test/source/metacall_rust_load_from_package_test.cpp index 7f639f4bc..776ce0ebb 100644 --- a/source/tests/metacall_rust_load_from_package_test/source/metacall_rust_load_from_package_test.cpp +++ b/source/tests/metacall_rust_load_from_package_test/source/metacall_rust_load_from_package_test.cpp @@ -168,5 +168,5 @@ TEST_F(metacall_rust_load_from_mem_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_rust_test/source/metacall_rust_test.cpp b/source/tests/metacall_rust_test/source/metacall_rust_test.cpp index cbe3e2ef9..b0a2e9407 100644 --- a/source/tests/metacall_rust_test/source/metacall_rust_test.cpp +++ b/source/tests/metacall_rust_test/source/metacall_rust_test.cpp @@ -187,5 +187,5 @@ TEST_F(metacall_rust_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_sandbox_plugin_test/source/metacall_sandbox_plugin_test.cpp b/source/tests/metacall_sandbox_plugin_test/source/metacall_sandbox_plugin_test.cpp index 824da2ae1..6d0f186a1 100644 --- a/source/tests/metacall_sandbox_plugin_test/source/metacall_sandbox_plugin_test.cpp +++ b/source/tests/metacall_sandbox_plugin_test/source/metacall_sandbox_plugin_test.cpp @@ -291,7 +291,7 @@ TEST_F(metacall_sandbox_plugin_test, DefaultConstructor) metacall_value_destroy(args[0]); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } /* [Note] This test blocks all the gtest context, so you should comment it to allow testing for other test cases */ @@ -330,7 +330,7 @@ TEST_F(metacall_sandbox_plugin_test, SANDBOX_IO_DISABLE_TEST) metacall_value_destroy(args[0]); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } TEST_F(metacall_sandbox_plugin_test, SANDBOX_SOCKETS_DISABLE_TEST) @@ -381,7 +381,7 @@ TEST_F(metacall_sandbox_plugin_test, SANDBOX_SOCKETS_DISABLE_TEST) metacall_value_destroy(args[0]); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } TEST_F(metacall_sandbox_plugin_test, SANDBOX_IPC_DISABLE_TEST) @@ -432,7 +432,7 @@ TEST_F(metacall_sandbox_plugin_test, SANDBOX_IPC_DISABLE_TEST) metacall_value_destroy(args[0]); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } TEST_F(metacall_sandbox_plugin_test, SANDBOX_PROCESS_DISABLE_TEST) @@ -470,7 +470,7 @@ TEST_F(metacall_sandbox_plugin_test, SANDBOX_PROCESS_DISABLE_TEST) metacall_value_destroy(args[0]); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } TEST_F(metacall_sandbox_plugin_test, SANDBOX_FILESYSTEMS_DISABLE_TEST) @@ -508,7 +508,7 @@ TEST_F(metacall_sandbox_plugin_test, SANDBOX_FILESYSTEMS_DISABLE_TEST) metacall_value_destroy(args[0]); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } TEST_F(metacall_sandbox_plugin_test, SANDBOX_TIME_DISABLE_TEST) @@ -559,7 +559,7 @@ TEST_F(metacall_sandbox_plugin_test, SANDBOX_TIME_DISABLE_TEST) metacall_value_destroy(args[0]); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } TEST_F(metacall_sandbox_plugin_test, SANDBOX_MEMORY_DISABLE_TEST) @@ -597,7 +597,7 @@ TEST_F(metacall_sandbox_plugin_test, SANDBOX_MEMORY_DISABLE_TEST) metacall_value_destroy(args[0]); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } TEST_F(metacall_sandbox_plugin_test, SANDBOX_SIGNALS_DISABLE_TEST) @@ -648,5 +648,5 @@ TEST_F(metacall_sandbox_plugin_test, SANDBOX_SIGNALS_DISABLE_TEST) metacall_value_destroy(args[0]); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_test/source/metacall_test.cpp b/source/tests/metacall_test/source/metacall_test.cpp index 4deebb150..cf9d864a2 100644 --- a/source/tests/metacall_test/source/metacall_test.cpp +++ b/source/tests/metacall_test/source/metacall_test.cpp @@ -605,5 +605,5 @@ TEST_F(metacall_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_test/source/metacall_test_split.cpp b/source/tests/metacall_test/source/metacall_test_split.cpp index 1064365b1..dead0c91e 100644 --- a/source/tests/metacall_test/source/metacall_test_split.cpp +++ b/source/tests/metacall_test/source/metacall_test_split.cpp @@ -44,7 +44,7 @@ TEST_F(metacall_test, DefaultConstructor) EXPECT_EQ((int)0, (int)metacall_initialize()); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } class metacall_loader_test : public testing::Test @@ -63,7 +63,7 @@ class metacall_loader_test : public testing::Test ~metacall_loader_test() { - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } }; diff --git a/source/tests/metacall_typescript_call_map_test/source/metacall_typescript_call_map_test.cpp b/source/tests/metacall_typescript_call_map_test/source/metacall_typescript_call_map_test.cpp index 923f8e048..d9cf65a80 100644 --- a/source/tests/metacall_typescript_call_map_test/source/metacall_typescript_call_map_test.cpp +++ b/source/tests/metacall_typescript_call_map_test/source/metacall_typescript_call_map_test.cpp @@ -79,5 +79,5 @@ TEST_F(metacall_typescript_call_map_test, DefaultConstructor) metacall_allocator_destroy(allocator); - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_typescript_jsx_default_test/source/metacall_typescript_jsx_default_test.cpp b/source/tests/metacall_typescript_jsx_default_test/source/metacall_typescript_jsx_default_test.cpp index 7ac88e6da..0930ddff3 100644 --- a/source/tests/metacall_typescript_jsx_default_test/source/metacall_typescript_jsx_default_test.cpp +++ b/source/tests/metacall_typescript_jsx_default_test/source/metacall_typescript_jsx_default_test.cpp @@ -47,5 +47,5 @@ TEST_F(metacall_typescript_jsx_default_test, DefaultConstructor) } #endif /* OPTION_BUILD_LOADERS_TS */ - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_typescript_node_test/source/metacall_typescript_node_test.cpp b/source/tests/metacall_typescript_node_test/source/metacall_typescript_node_test.cpp index 9f51a73c4..95a65c98b 100644 --- a/source/tests/metacall_typescript_node_test/source/metacall_typescript_node_test.cpp +++ b/source/tests/metacall_typescript_node_test/source/metacall_typescript_node_test.cpp @@ -138,5 +138,5 @@ TEST_F(metacall_typescript_node_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_typescript_require_test/source/metacall_typescript_require_test.cpp b/source/tests/metacall_typescript_require_test/source/metacall_typescript_require_test.cpp index 8ec87717f..13d90c515 100644 --- a/source/tests/metacall_typescript_require_test/source/metacall_typescript_require_test.cpp +++ b/source/tests/metacall_typescript_require_test/source/metacall_typescript_require_test.cpp @@ -77,5 +77,5 @@ TEST_F(metacall_typescript_require_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_typescript_test/source/metacall_typescript_test.cpp b/source/tests/metacall_typescript_test/source/metacall_typescript_test.cpp index 60d186821..8b3488797 100644 --- a/source/tests/metacall_typescript_test/source/metacall_typescript_test.cpp +++ b/source/tests/metacall_typescript_test/source/metacall_typescript_test.cpp @@ -126,5 +126,5 @@ TEST_F(metacall_typescript_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_typescript_tsx_loop_fail_test/source/metacall_typescript_tsx_loop_fail_test.cpp b/source/tests/metacall_typescript_tsx_loop_fail_test/source/metacall_typescript_tsx_loop_fail_test.cpp index 1635e15a0..8256b3481 100644 --- a/source/tests/metacall_typescript_tsx_loop_fail_test/source/metacall_typescript_tsx_loop_fail_test.cpp +++ b/source/tests/metacall_typescript_tsx_loop_fail_test/source/metacall_typescript_tsx_loop_fail_test.cpp @@ -68,5 +68,5 @@ TEST_F(metacall_tsx_loop_fail_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_typescript_tsx_test/source/metacall_typescript_tsx_test.cpp b/source/tests/metacall_typescript_tsx_test/source/metacall_typescript_tsx_test.cpp index 82a9dc0c6..0723b6eed 100644 --- a/source/tests/metacall_typescript_tsx_test/source/metacall_typescript_tsx_test.cpp +++ b/source/tests/metacall_typescript_tsx_test/source/metacall_typescript_tsx_test.cpp @@ -79,5 +79,5 @@ TEST_F(metacall_tsx_test, DefaultConstructor) metacall_allocator_destroy(allocator); } - EXPECT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } diff --git a/source/tests/metacall_wasm_test/source/metacall_wasm_test.cpp b/source/tests/metacall_wasm_test/source/metacall_wasm_test.cpp index eb49b144c..2c5515ed8 100644 --- a/source/tests/metacall_wasm_test/source/metacall_wasm_test.cpp +++ b/source/tests/metacall_wasm_test/source/metacall_wasm_test.cpp @@ -192,5 +192,5 @@ TEST_F(metacall_wasm_test, Default) ASSERT_EQ((int)1, (int)metacall_load_from_file("wasm", modules, sizeof(modules) / sizeof(modules[0]), NULL)); } - ASSERT_EQ((int)0, (int)metacall_destroy()); + metacall_destroy(); } From 0fe22954b27534e32a51c8b2a021c87b50cce7d1 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 14 Jan 2025 17:12:21 +0100 Subject: [PATCH 14/66] Add NodeJS support for load_from_package and execution_path, add test with libgit2, solve issues c_loader. --- cmake/FindLibGit2.cmake | 78 ++++++ .../loaders/c_loader/source/c_loader_impl.cpp | 47 +++- .../node_loader/source/node_loader_port.cpp | 261 ++++++++++++++++++ source/ports/node_port/index.d.ts | 3 + source/ports/node_port/index.js | 39 +++ source/tests/CMakeLists.txt | 1 + .../CMakeLists.txt | 167 +++++++++++ .../source/main.cpp | 28 ++ .../source/metacall_node_port_c_lib_test.cpp | 57 ++++ tools/metacall-environment.ps1 | 21 ++ tools/metacall-environment.sh | 17 +- 11 files changed, 711 insertions(+), 8 deletions(-) create mode 100644 cmake/FindLibGit2.cmake create mode 100644 source/tests/metacall_node_port_c_lib_test/CMakeLists.txt create mode 100644 source/tests/metacall_node_port_c_lib_test/source/main.cpp create mode 100644 source/tests/metacall_node_port_c_lib_test/source/metacall_node_port_c_lib_test.cpp diff --git a/cmake/FindLibGit2.cmake b/cmake/FindLibGit2.cmake new file mode 100644 index 000000000..787b5319c --- /dev/null +++ b/cmake/FindLibGit2.cmake @@ -0,0 +1,78 @@ +# +# CMake Find LibGit2 Library by Parra Studios +# Copyright (C) 2016 - 2025 Vicente Eduardo Ferrer Garcia +# + +# Find libgit2 library and include paths +# +# LibGit2_FOUND - True if LibGit2 was found +# LibGit2_INCLUDE_DIR - LibGit2 headers path +# LibGit2_VERSION - LibGit2 version +# LibGit2_VERSION_MAJOR - LibGit2 major version +# LibGit2_VERSION_MINOR - LibGit2 minor version +# LibGit2_VERSION_REVISION - LibGit2 patch version +# LibGit2_LIBRARY - LibGit2 shared library +# LibGit2_LIBRARY_DIR - LibGit2 shared library folder +# + +# Prevent vervosity if already included +if(LibGit2_LIBRARY) + set(LibGit2_FIND_QUIETLY TRUE) +endif() + +# Include package manager +include(FindPackageHandleStandardArgs) + +# Find via PkgConfig +find_package(PkgConfig QUIET) +pkg_check_modules(PKG_GIT2 QUIET libgit2) + +if(NOT LibGit2_DEFINITIONS) + set(LibGit2_DEFINITIONS ${PKG_GIT2_CFLAGS_OTHER}) +endif() + +if(NOT LibGit2_INCLUDE_DIR) + find_path(LibGit2_INCLUDE_DIR + NAMES git2.h + HINTS ${PKG_GIT2_INCLUDE_DIRS} + ) +endif() + +if(NOT LibGit2_VERSION AND LibGit2_INCLUDE_DIR) + file(STRINGS "${LibGit2_INCLUDE_DIR}/git2/version.h" LibGit2_VERSION_MAJOR REGEX "^#define LIBGIT2_VER_MAJOR +([0-9]+)") + string(REGEX MATCH "([0-9]+)$" LibGit2_VERSION_MAJOR ${LibGit2_VERSION_MAJOR}) + + file(STRINGS "${LibGit2_INCLUDE_DIR}/git2/version.h" LibGit2_VERSION_MINOR REGEX "^#define LIBGIT2_VER_MINOR +([0-9]+)") + string(REGEX MATCH "([0-9]+)$" LibGit2_VERSION_MINOR ${LibGit2_VERSION_MINOR}) + + file(STRINGS "${LibGit2_INCLUDE_DIR}/git2/version.h" LibGit2_VERSION_REVISION REGEX "^#define LIBGIT2_VER_REVISION +([0-9]+)") + string(REGEX MATCH "([0-9]+)$" LibGit2_VERSION_REVISION ${LibGit2_VERSION_REVISION}) + + set(LibGit2_VERSION "${LibGit2_VERSION_MAJOR}.${LibGit2_VERSION_MINOR}.${LibGit2_VERSION_REVISION}") +endif() + +if(NOT LibGit2_LIBRARY) + find_library(LibGit2_LIBRARY + NAMES git2 + HINTS ${PKG_GIT2_LIBRARY_DIRS} + ) +endif() + +set(LibGit2_LIBRARIES ${LibGit2_LIBRARY}) +set(LibGit2_INCLUDE_DIRS ${LibGit2_INCLUDE_DIR}) +get_filename_component(LibGit2_LIBRARY_DIR ${LibGit2_LIBRARY} DIRECTORY) + +# Define package +find_package_handle_standard_args(LibGit2 + FOUND_VAR + LibGit2_FOUND + REQUIRED_VARS + LibGit2_LIBRARY + LibGit2_LIBRARY_DIR + LibGit2_INCLUDE_DIR + LibGit2_INCLUDE_DIRS + VERSION_VAR + LibGit2_VERSION +) + +mark_as_advanced(LibGit2_LIBRARY LibGit2_LIBRARY_DIR LibGit2_INCLUDE_DIR) diff --git a/source/loaders/c_loader/source/c_loader_impl.cpp b/source/loaders/c_loader/source/c_loader_impl.cpp index 52ead7b7c..4ad6689bf 100644 --- a/source/loaders/c_loader/source/c_loader_impl.cpp +++ b/source/loaders/c_loader/source/c_loader_impl.cpp @@ -81,6 +81,8 @@ typedef struct loader_impl_c_handle_base_type virtual ~loader_impl_c_handle_base_type() {} + virtual bool recursive_includes() = 0; + virtual int discover(loader_impl impl, context ctx) = 0; virtual const void *symbol(std::string &name) = 0; @@ -136,6 +138,11 @@ typedef struct loader_impl_c_handle_tcc_type : loader_impl_c_handle_base_type } } + bool recursive_includes() + { + return false; + } + bool initialize(loader_impl_c c_impl) { this->state = tcc_new(); @@ -232,6 +239,11 @@ typedef struct loader_impl_c_handle_dynlink_type : loader_impl_c_handle_base_typ } } + bool recursive_includes() + { + return true; + } + bool initialize(loader_impl_c c_impl, const loader_path path) { std::string lib_path_str(path); @@ -1022,12 +1034,18 @@ static int c_loader_impl_discover_signature(loader_impl impl, loader_impl_c_hand symbol_name.insert(0, 1, '_'); #endif + if (scope_get(sp, symbol_name.c_str()) != NULL) + { + log_write("metacall", LOG_LEVEL_WARNING, "Symbol '%s' redefined, skipping the function", func_name.c_str()); + return 0; + } + const void *address = c_handle->symbol(symbol_name); if (address == NULL) { - log_write("metacall", LOG_LEVEL_ERROR, "Symbol '%s' not found, skipping the function", func_name.c_str()); - return 1; + log_write("metacall", LOG_LEVEL_WARNING, "Symbol '%s' not found, skipping the function", func_name.c_str()); + return 0; } loader_impl_c_function c_function = new loader_impl_c_function_type(address); @@ -1080,9 +1098,13 @@ static CXChildVisitResult c_loader_impl_discover_visitor(CXCursor cursor, CXCurs { c_loader_impl_discover_visitor_data visitor_data = static_cast(data); - if (clang_Location_isFromMainFile(clang_getCursorLocation(cursor)) == 0) + /* Include recursively when disabled, include only the header inlcuded is populated when enabled */ + if (visitor_data->c_handle->recursive_includes() == false) { - return CXChildVisit_Continue; + if (clang_Location_isFromMainFile(clang_getCursorLocation(cursor)) == 0) + { + return CXChildVisit_Continue; + } } CXCursorKind kind = clang_getCursorKind(cursor); @@ -1102,6 +1124,7 @@ static CXChildVisitResult c_loader_impl_discover_visitor(CXCursor cursor, CXCurs static int c_loader_impl_discover_ast(loader_impl impl, loader_impl_c_handle_base c_handle, context ctx) { + loader_impl_c c_impl = static_cast(loader_impl_get(impl)); c_loader_impl_discover_visitor_data_type data = { impl, c_handle, @@ -1109,12 +1132,24 @@ static int c_loader_impl_discover_ast(loader_impl impl, loader_impl_c_handle_bas 0 }; + std::vector includes; + std::vector command_line_args; + + /* Otherwise, check the execution paths */ + for (auto exec_path : c_impl->execution_paths) + { + includes.push_back("-I" + exec_path); + command_line_args.push_back(includes.back().c_str()); + } + for (std::string file : c_handle->files) { - CXIndex index = clang_createIndex(0, 0); + /* Define the command line arguments (simulating compiler flags) */ + CXIndex index = clang_createIndex(0, 1); CXTranslationUnit unit = clang_parseTranslationUnit( index, - file.c_str(), nullptr, 0, + file.c_str(), + command_line_args.data(), command_line_args.size(), nullptr, 0, CXTranslationUnit_None); diff --git a/source/loaders/node_loader/source/node_loader_port.cpp b/source/loaders/node_loader/source/node_loader_port.cpp index 773e62cca..4a4e22421 100644 --- a/source/loaders/node_loader/source/node_loader_port.cpp +++ b/source/loaders/node_loader/source/node_loader_port.cpp @@ -281,6 +281,94 @@ napi_value node_loader_port_metacall_await(napi_env env, napi_callback_info info return promise; } +/** +* @brief +* Define an execution path into a runtime +* +* @param[in] env +* N-API reference to the enviroment +* +* @param[in] info +* Reference to the call information +* +* @return +* TODO: Not implemented yet +*/ +napi_value node_loader_port_metacall_execution_path(napi_env env, napi_callback_info info) +{ + const size_t args_size = 2; + size_t argc = args_size, tag_length, path_length; + napi_value argv[args_size]; + + /* Get arguments */ + napi_status status = napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); + + node_loader_impl_exception(env, status); + + /* Get tag length */ + status = napi_get_value_string_utf8(env, argv[0], nullptr, 0, &tag_length); + + node_loader_impl_exception(env, status); + + /* Allocate tag */ + char *tag = new char[tag_length + 1]; + + if (tag == nullptr) + { + napi_throw_error(env, nullptr, "MetaCall could not define an execution path, tag allocation failed"); + return nullptr; + } + + /* Get tag */ + status = napi_get_value_string_utf8(env, argv[0], tag, tag_length + 1, &tag_length); + + node_loader_impl_exception(env, status); + + /* Get path length */ + status = napi_get_value_string_utf8(env, argv[1], nullptr, 0, &path_length); + + node_loader_impl_exception(env, status); + + size_t path_size = path_length + 1; + + /* Allocate path */ + char *path = new char[path_size]; + + if (path == nullptr) + { + napi_throw_error(env, nullptr, "MetaCall could not define an execution path, path allocation failed"); + delete[] tag; + return nullptr; + } + + /* Get path */ + status = napi_get_value_string_utf8(env, argv[1], path, path_size, &path_length); + + node_loader_impl_exception(env, status); + + /* Obtain NodeJS loader implementation */ + loader_impl impl = loader_get_impl(node_loader_tag); + loader_impl_node node_impl = (loader_impl_node)loader_impl_get(impl); + + /* Store current reference of the environment */ + node_loader_impl_env(node_impl, env); + + /* Define execution path */ + if (metacall_execution_path(tag, path) != 0) + { + napi_throw_error(env, nullptr, "MetaCall could not define an execution path"); + } + + /* Release current reference of the environment */ + // node_loader_impl_env(node_impl, nullptr); + + delete[] tag; + delete[] path; + + /* TODO: Return value and logs */ + return nullptr; +} + napi_value node_loader_port_metacall_load_from_file(napi_env env, napi_callback_info info) { /* TODO: Detect if input argument types are valid */ @@ -628,6 +716,176 @@ napi_value node_loader_port_metacall_load_from_memory_export(napi_env env, napi_ return v_exports; } +/** +* @brief +* Load a package by tag +* +* @param[in] env +* N-API reference to the enviroment +* +* @param[in] info +* Reference to the call information +* +* @return +* TODO: Not implemented yet +*/ +napi_value node_loader_port_metacall_load_from_package(napi_env env, napi_callback_info info) +{ + const size_t args_size = 2; + size_t argc = args_size, tag_length, package_length; + napi_value argv[args_size]; + + /* Get arguments */ + napi_status status = napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); + + node_loader_impl_exception(env, status); + + /* Get tag length */ + status = napi_get_value_string_utf8(env, argv[0], nullptr, 0, &tag_length); + + node_loader_impl_exception(env, status); + + /* Allocate tag */ + char *tag = new char[tag_length + 1]; + + if (tag == nullptr) + { + napi_throw_error(env, nullptr, "MetaCall could not load from package, tag allocation failed"); + return nullptr; + } + + /* Get tag */ + status = napi_get_value_string_utf8(env, argv[0], tag, tag_length + 1, &tag_length); + + node_loader_impl_exception(env, status); + + /* Get package length */ + status = napi_get_value_string_utf8(env, argv[1], nullptr, 0, &package_length); + + node_loader_impl_exception(env, status); + + size_t package_size = package_length + 1; + + /* Allocate package */ + char *package = new char[package_size]; + + if (package == nullptr) + { + napi_throw_error(env, nullptr, "MetaCall could not load from package, package allocation failed"); + delete[] tag; + return nullptr; + } + + /* Get package */ + status = napi_get_value_string_utf8(env, argv[1], package, package_size, &package_length); + + node_loader_impl_exception(env, status); + + /* Obtain NodeJS loader implementation */ + loader_impl impl = loader_get_impl(node_loader_tag); + loader_impl_node node_impl = (loader_impl_node)loader_impl_get(impl); + + /* Store current reference of the environment */ + node_loader_impl_env(node_impl, env); + + /* Load the package */ + if (metacall_load_from_package(tag, package, NULL) != 0) + { + napi_throw_error(env, nullptr, "MetaCall could not load a package"); + } + + /* Release current reference of the environment */ + // node_loader_impl_env(node_impl, nullptr); + + delete[] tag; + delete[] package; + + /* TODO: Return value and logs */ + return nullptr; +} + +napi_value node_loader_port_metacall_load_from_package_export(napi_env env, napi_callback_info info) +{ + const size_t args_size = 2; + size_t argc = args_size, tag_length, package_length; + napi_value argv[args_size]; + + /* Get arguments */ + napi_status status = napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); + + node_loader_impl_exception(env, status); + + /* Get tag length */ + status = napi_get_value_string_utf8(env, argv[0], nullptr, 0, &tag_length); + + node_loader_impl_exception(env, status); + + /* Allocate tag */ + char *tag = new char[tag_length + 1]; + + if (tag == nullptr) + { + napi_throw_error(env, nullptr, "MetaCall could not load from memory, tag allocation failed"); + return nullptr; + } + + /* Get tag */ + status = napi_get_value_string_utf8(env, argv[0], tag, tag_length + 1, &tag_length); + + node_loader_impl_exception(env, status); + + /* Get package length */ + status = napi_get_value_string_utf8(env, argv[1], nullptr, 0, &package_length); + + node_loader_impl_exception(env, status); + + size_t package_size = package_length + 1; + + /* Allocate package */ + char *package = new char[package_size]; + + if (package == nullptr) + { + napi_throw_error(env, nullptr, "MetaCall could not load from package, package allocation failed"); + delete[] tag; + return nullptr; + } + + /* Get package */ + status = napi_get_value_string_utf8(env, argv[1], package, package_size, &package_length); + + node_loader_impl_exception(env, status); + + /* Obtain NodeJS loader implementation */ + loader_impl impl = loader_get_impl(node_loader_tag); + loader_impl_node node_impl = (loader_impl_node)loader_impl_get(impl); + + /* Store current reference of the environment */ + node_loader_impl_env(node_impl, env); + + void *handle = NULL; + + /* Load package from package */ + if (metacall_load_from_package(tag, package, &handle) != 0) + { + napi_throw_error(env, nullptr, "MetaCall could not load from package"); + } + + /* Release current reference of the environment */ + // node_loader_impl_env(node_impl, nullptr); + + delete[] tag; + delete[] package; + + void *exports = metacall_handle_export(handle); + + napi_value v_exports = node_loader_impl_value_to_napi(node_impl, env, exports); + + node_loader_impl_finalizer(env, v_exports, exports); + + return v_exports; +} + /** * @brief * Loads a script from configuration path @@ -829,10 +1087,13 @@ void node_loader_port_exports(napi_env env, napi_value exports) x(metacall); \ x(metacallfms); \ x(metacall_await); \ + x(metacall_execution_path); \ x(metacall_load_from_file); \ x(metacall_load_from_file_export); \ x(metacall_load_from_memory); \ x(metacall_load_from_memory_export); \ + x(metacall_load_from_package); \ + x(metacall_load_from_package_export); \ x(metacall_load_from_configuration); \ x(metacall_load_from_configuration_export); \ x(metacall_inspect); \ diff --git a/source/ports/node_port/index.d.ts b/source/ports/node_port/index.d.ts index 7b1d6d1bd..3be9a4809 100644 --- a/source/ports/node_port/index.d.ts +++ b/source/ports/node_port/index.d.ts @@ -1,10 +1,13 @@ declare module 'metacall' { export function metacall(name: string, ...args: any): any; export function metacallfms(name: string, buffer: string): any; + export function metacall_execution_path(tag: string, path: string): number; export function metacall_load_from_file(tag: string, paths: string[]): number; export function metacall_load_from_file_export(tag: string, paths: string[]): any; export function metacall_load_from_memory(tag: string, code: string): number; export function metacall_load_from_memory_export(tag: string, code: string): any; + export function metacall_load_from_package(tag: string, pkg: string): number; + export function metacall_load_from_package_export(tag: string, pkg: string): any; export function metacall_load_from_configuration(path: string): number; export function metacall_load_from_configuration_export(path: string): any; export function metacall_inspect(): any; diff --git a/source/ports/node_port/index.js b/source/ports/node_port/index.js index 2372b3fd5..296e33e68 100644 --- a/source/ports/node_port/index.js +++ b/source/ports/node_port/index.js @@ -185,6 +185,18 @@ const metacall_await = (name, ...args) => { return addon.metacall_await(name, ...args); }; +const metacall_execution_path = (tag, path) => { + if (Object.prototype.toString.call(tag) !== '[object String]') { + throw Error('Tag should be a string indicating the id of the loader to be used [py, rb, cs, js, node, mock...].'); + } + + if (Object.prototype.toString.call(path) !== '[object String]') { + throw Error('The path should be of string type.'); + } + + return addon.metacall_execution_path(tag, path); +}; + const metacall_load_from_file = (tag, paths) => { if (Object.prototype.toString.call(tag) !== '[object String]') { throw Error('Tag should be a string indicating the id of the loader to be used [py, rb, cs, js, node, mock...].'); @@ -233,6 +245,30 @@ const metacall_load_from_memory_export = (tag, code) => { return addon.metacall_load_from_memory_export(tag, code); }; +const metacall_load_from_package = (tag, pkg) => { + if (Object.prototype.toString.call(tag) !== '[object String]') { + throw Error('Tag should be a string indicating the id of the loader to be used [py, rb, cs, js, node, mock...].'); + } + + if (Object.prototype.toString.call(pkg) !== '[object String]') { + throw Error('Package should be a string with the id or path to the package.'); + } + + return addon.metacall_load_from_package(tag, pkg); +}; + +const metacall_load_from_package_export = (tag, pkg) => { + if (Object.prototype.toString.call(tag) !== '[object String]') { + throw Error('Tag should be a string indicating the id of the loader to be used [py, rb, cs, js, node, mock...].'); + } + + if (Object.prototype.toString.call(pkg) !== '[object String]') { + throw Error('Package should be a string with the id or path to the package.'); + } + + return addon.metacall_load_from_package_export(tag, pkg); +}; + const metacall_load_from_configuration = (path) => { if (Object.prototype.toString.call(path) !== '[object String]') { throw Error('Path should be a string indicating the path where the metacall.json is located.'); @@ -290,10 +326,13 @@ const module_exports = { metacallfms, metacall_await, metacall_inspect, + metacall_execution_path, metacall_load_from_file, metacall_load_from_file_export, metacall_load_from_memory, metacall_load_from_memory_export, + metacall_load_from_package, + metacall_load_from_package_export, metacall_load_from_configuration, metacall_load_from_configuration_export, metacall_handle, diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt index eb70ae1c7..aca1cfdaa 100644 --- a/source/tests/CMakeLists.txt +++ b/source/tests/CMakeLists.txt @@ -128,6 +128,7 @@ add_subdirectory(metacall_node_reentrant_test) add_subdirectory(metacall_node_port_test) add_subdirectory(metacall_node_port_await_test) add_subdirectory(metacall_node_port_rs_test) +add_subdirectory(metacall_node_port_c_lib_test) add_subdirectory(metacall_node_python_port_mock_test) add_subdirectory(metacall_node_python_port_ruby_test) add_subdirectory(metacall_node_python_ruby_test) diff --git a/source/tests/metacall_node_port_c_lib_test/CMakeLists.txt b/source/tests/metacall_node_port_c_lib_test/CMakeLists.txt new file mode 100644 index 000000000..0f4436b10 --- /dev/null +++ b/source/tests/metacall_node_port_c_lib_test/CMakeLists.txt @@ -0,0 +1,167 @@ +# Check if this loader is enabled +if(NOT OPTION_BUILD_LOADERS OR NOT OPTION_BUILD_LOADERS_NODE OR NOT OPTION_BUILD_LOADERS_C OR NOT OPTION_BUILD_PORTS OR NOT OPTION_BUILD_PORTS_NODE) + return() +endif() + +# +# External dependencies +# + +find_package(LibGit2) + +if(NOT LibGit2_FOUND) + message(WARNING "LibGit2 libraries not found, skipping test metacall-node-port-c-lib-test") + return() +endif() + +# +# Executable name and options +# + +# Target name +set(target metacall-node-port-c-lib-test) +message(STATUS "Test ${target}") + +# +# Compiler warnings +# + +include(Warnings) + +# +# Compiler security +# + +include(SecurityFlags) + +# +# Sources +# + +set(include_path "${CMAKE_CURRENT_SOURCE_DIR}/include/${target}") +set(source_path "${CMAKE_CURRENT_SOURCE_DIR}/source") + +set(sources + ${source_path}/main.cpp + ${source_path}/metacall_node_port_c_lib_test.cpp +) + +# Group source files +set(header_group "Header Files (API)") +set(source_group "Source Files") +source_group_by_path(${include_path} "\\\\.h$|\\\\.hpp$" + ${header_group} ${headers}) +source_group_by_path(${source_path} "\\\\.cpp$|\\\\.c$|\\\\.h$|\\\\.hpp$" + ${source_group} ${sources}) + +# +# Create executable +# + +# Build executable +add_executable(${target} + ${sources} +) + +# Create namespaced alias +add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target}) + +# +# Project options +# + +set_target_properties(${target} + PROPERTIES + ${DEFAULT_PROJECT_OPTIONS} + FOLDER "${IDE_FOLDER}" +) + +# +# Include directories +# + +target_include_directories(${target} + PRIVATE + ${DEFAULT_INCLUDE_DIRECTORIES} + ${PROJECT_BINARY_DIR}/source/include +) + +# +# Libraries +# + +target_link_libraries(${target} + PRIVATE + ${DEFAULT_LIBRARIES} + + GTest + + ${META_PROJECT_NAME}::metacall +) + +# +# Compile definitions +# + +target_compile_definitions(${target} + PRIVATE + ${DEFAULT_COMPILE_DEFINITIONS} + + # NodeJS Port path + METACALL_NODE_PORT_PATH="${CMAKE_SOURCE_DIR}/source/ports/node_port/index.js" + + # LibGit2 paths + LIBGIT2_LIBRARY_DIR="${LibGit2_LIBRARY_DIR}" + LIBGIT2_INCLUDE_DIR="${LibGit2_INCLUDE_DIR}" +) + +# +# Compile options +# + +target_compile_options(${target} + PRIVATE + ${DEFAULT_COMPILE_OPTIONS} +) + +# +# Linker options +# + +target_link_libraries(${target} + PRIVATE + ${DEFAULT_LINKER_OPTIONS} +) + +# +# Define test +# + +add_test(NAME ${target} + COMMAND $ +) + +# +# Define dependencies +# + +add_dependencies(${target} + node_port + node_loader + c_loader +) + +# +# Define test properties +# + +set_property(TEST ${target} + PROPERTY LABELS ${target} +) + +include(TestEnvironmentVariables) + +test_environment_variables(${target} + "" + ${TESTS_ENVIRONMENT_VARIABLES} +) diff --git a/source/tests/metacall_node_port_c_lib_test/source/main.cpp b/source/tests/metacall_node_port_c_lib_test/source/main.cpp new file mode 100644 index 000000000..11ddf3f59 --- /dev/null +++ b/source/tests/metacall_node_port_c_lib_test/source/main.cpp @@ -0,0 +1,28 @@ +/* + * MetaCall Library by Parra Studios + * A library for providing a foreign function interface calls. + * + * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + + return RUN_ALL_TESTS(); +} diff --git a/source/tests/metacall_node_port_c_lib_test/source/metacall_node_port_c_lib_test.cpp b/source/tests/metacall_node_port_c_lib_test/source/metacall_node_port_c_lib_test.cpp new file mode 100644 index 000000000..faa944974 --- /dev/null +++ b/source/tests/metacall_node_port_c_lib_test/source/metacall_node_port_c_lib_test.cpp @@ -0,0 +1,57 @@ +/* + * MetaCall Library by Parra Studios + * A library for providing a foreign function interface calls. + * + * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include +#include +#include + +class metacall_node_port_c_lib_test : public testing::Test +{ +public: +}; + +TEST_F(metacall_node_port_c_lib_test, DefaultConstructor) +{ + metacall_print_info(); + + ASSERT_EQ((int)0, (int)metacall_initialize()); + + static const char buffer[] = + /* NodeJS */ + "const assert = require('assert');\n" + "const { metacall_execution_path, metacall_load_from_package_export } = require('" METACALL_NODE_PORT_PATH "');\n" + /* C Lib Paths */ + "metacall_execution_path('c', '" LIBGIT2_INCLUDE_DIR "');\n" + "metacall_execution_path('c', '" LIBGIT2_LIBRARY_DIR "');\n" + /* C Lib Require */ + "const git2 = metacall_load_from_package_export('c', 'git2');\n" + "const { git_libgit2_init, git_libgit2_shutdown } = git2;\n" + "console.log(git2);\n" + /* C Lib Assert */ + "assert(git_libgit2_init() >= 0, 'libgit2 initialization failed');\n" + "git_libgit2_shutdown();\n" + "\n"; + + ASSERT_EQ((int)0, (int)metacall_load_from_memory("node", buffer, sizeof(buffer), NULL)); + + metacall_destroy(); +} diff --git a/tools/metacall-environment.ps1 b/tools/metacall-environment.ps1 index 1638de22c..dd2191520 100755 --- a/tools/metacall-environment.ps1 +++ b/tools/metacall-environment.ps1 @@ -126,6 +126,27 @@ function Set-Nodejs { Write-Output "-DNodeJS_EXECUTABLE=""$NodeDir/node.exe""" >> $EnvOpts Write-Output "-DNodeJS_LIBRARY_NAME=""libnode.dll""" >> $EnvOpts Write-Output "-DNodeJS_LIBRARY_NAME_PATH=""$NodeDir/lib/libnode.dll""" >> $EnvOpts + + if ($Arguments -contains "c") { + # Required for test source/tests/metacall_node_port_c_lib_test + if (!(Test-Path -Path "$DepsDir\libgit2")) { + # Clone libgit2 + git clone --depth 1 --branch v1.8.4 https://github.com/libgit2/libgit2 + } + + $InstallDir = "$DepsDir\libgit2\build\dist" + + mkdir "$DepsDir\libgit2\build" + mkdir "$InstallDir" + Set-Location "$DepsDir\libgit2\build" + + cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=OFF -DBUILD_CLI=OFF .. + cmake --build . "-j$((Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors)" + cmake --install . --prefix "$InstallDir" + + Write-Output "-DLibGit2_LIBRARY=""$InstallDir\lib\git2.lib""" >> $EnvOpts + Write-Output "-DLibGit2_INCLUDE_DIR=""$InstallDir\include""" >> $EnvOpts + } } function Set-Java { diff --git a/tools/metacall-environment.sh b/tools/metacall-environment.sh index 304fa6a02..d2983330b 100755 --- a/tools/metacall-environment.sh +++ b/tools/metacall-environment.sh @@ -464,11 +464,18 @@ sub_nodejs(){ cd $ROOT_DIR if [ "${OPERATIVE_SYSTEM}" = "Linux" ]; then + if [ $INSTALL_C = 1 ]; then + # Required for test source/tests/metacall_node_port_c_lib_test + INSTALL_LIBGIT2="libgit2-dev" + else + INSTALL_LIBGIT2="" + fi + if [ "${LINUX_DISTRO}" = "debian" ] || [ "${LINUX_DISTRO}" = "ubuntu" ]; then # Note that Python is required for GYP - $SUDO_CMD apt-get $APT_CACHE_CMD install -y --no-install-recommends python3 g++ make nodejs npm curl + $SUDO_CMD apt-get $APT_CACHE_CMD install -y --no-install-recommends python3 g++ make nodejs npm curl $INSTALL_LIBGIT2 elif [ "${LINUX_DISTRO}" = "alpine" ]; then - $SUDO_CMD apk add --no-cache python3 g++ make nodejs nodejs-dev npm curl + $SUDO_CMD apk add --no-cache python3 g++ make nodejs nodejs-dev npm curl $INSTALL_LIBGIT2 # Build dependencies (note libexecinfo-dev is not available in Alpine 3.17) $SUDO_CMD apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/v3.16/main linux-headers libexecinfo libexecinfo-dev @@ -557,6 +564,12 @@ sub_nodejs(){ # Configure NPM path echo "-DNPM_ROOT=$NODE_PREFIX/bin" >> $CMAKE_CONFIG_PATH + if [ $INSTALL_C = 1 ]; then + # Required for test source/tests/metacall_node_port_c_lib_test + brew install libgit2@1.8 + brew link libgit2@1.8 --force --overwrite + fi + # fi fi } From 50c27f21a5d5cb5ead48716cbca48f6f5189ea6e Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 29 Jan 2025 21:07:21 +0100 Subject: [PATCH 15/66] Add loader config with dependencies. --- CMakeLists.txt | 5 +- source/configuration/CMakeLists.txt | 10 +- source/loaders/CMakeLists.txt | 173 +++++++++++++++--- source/loaders/cs_loader/CMakeLists.txt | 13 +- .../loaders/cs_loader/data/cs_loader.json.in | 4 +- source/loaders/loader.json.in | 5 + source/loaders/node_loader/CMakeLists.txt | 27 ++- source/plugin/source/plugin_manager.c | 2 +- 8 files changed, 197 insertions(+), 42 deletions(-) create mode 100644 source/loaders/loader.json.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 6896e14f1..75da78355 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ # # CMake version -cmake_minimum_required(VERSION 3.14 FATAL_ERROR) +cmake_minimum_required(VERSION 3.15 FATAL_ERROR) # Include cmake modules @@ -241,6 +241,9 @@ else() endif() endif() +# Export compile commands +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + # # CTest configuration # diff --git a/source/configuration/CMakeLists.txt b/source/configuration/CMakeLists.txt index c38ca6feb..2332f0682 100644 --- a/source/configuration/CMakeLists.txt +++ b/source/configuration/CMakeLists.txt @@ -180,17 +180,19 @@ target_link_libraries(${target} function(configurations_write config_dir config_path) set(CONFIGURATION_GLOBAL "{") - if(OPTION_BUILD_LOADERS) - set(CONFIGURATION_GLOBAL_LOADERS 0) + # TODO: Make this automatic for all loaders + if(OPTION_BUILD_LOADERS) if(OPTION_BUILD_LOADERS_CS) set(CONFIGURATION_GLOBAL "${CONFIGURATION_GLOBAL}\n\t\"cs_loader\":\"${config_dir}/cs_loader.json\",") - set(CONFIGURATION_GLOBAL_LOADERS 1) + endif() + + if(OPTION_BUILD_LOADERS_NODE) + set(CONFIGURATION_GLOBAL "${CONFIGURATION_GLOBAL}\n\t\"node_loader\":\"${config_dir}/node_loader.json\",") endif() #if(OPTION_BUILD_LOADERS_JS) # set(CONFIGURATION_GLOBAL "${CONFIGURATION_GLOBAL}\n\t\"js_loader\":\"${config_dir}/js_loader.json\",") - # set(CONFIGURATION_GLOBAL_LOADERS 1) #endif() endif() diff --git a/source/loaders/CMakeLists.txt b/source/loaders/CMakeLists.txt index 2d992ee6f..2798d2722 100644 --- a/source/loaders/CMakeLists.txt +++ b/source/loaders/CMakeLists.txt @@ -26,6 +26,141 @@ option(OPTION_BUILD_LOADERS_RPC "Build cURL Remote Procedure Call loader plugin. option(OPTION_BUILD_LOADERS_TS "Build TypeScript 3.9.7 Runtime loader plugin." OFF) option(OPTION_BUILD_LOADERS_WASM "Build WebAssembly Virtual Machine loader plugin." OFF) +# +# Configuration for loaders +# +# The following list of macros is used for generating a configuration file which includes +# dependencies, this is required because now loaders can either load the dependencies or +# use the existing dependencies if MetaCall is being loaded from python.exe, node.exe +# or similar... so we require to delay the loader dependencies until we know if +# their dependencies are already present. +# +# This set of macros provies a flexible way of defining the configuration and dependencies. +# +# 1) The most basic case, let's assume we have the dependencies in the system, like in Python: +# +# loader_configuration_begin(py_loader) +# loader_configuration_deps(python "${Python3_LIBRARY}") +# loader_configuartion_end() +# +# 2) Maybe you want to have multiple paths for a library: +# +# loader_configuration_begin(node_loader) +# loader_configuration_deps(node "/path/to/libnode.so" "/alternative/path/to/libnode.so") +# loader_configuartion_end() +# +# 3) Or the dependencies are compiled by you and you so you have different folders for +# for development (build folder) and for when installing it: +# +# loader_configuration_begin(node_loader) +# loader_configuration_deps(node "/path/to/build/folder/libnode.so") +# loader_configuartion_end_development() +# +# loader_configuration_begin(node_loader) +# loader_configuration_deps(node "/path/to/install/folder/libnode.so") +# loader_configuartion_end_install() +# +# 4) Or you have a custom template because your loader needs a configuration with more fields: +# +# loader_configuration_begin(cs_loader) +# loader_configuration_deps(netcore "/path/to/build/folder/libnetcore.so") +# loader_configuartion_end() +# +# You can do any combination of those for defining the configuration of your loaders. +# + +# Define loader template configuration +set(LOADER_CONFIGURATION_DEFAULT_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/loader.json.in") + +# Define loader configuration for a specific loader +macro(loader_configuration_begin TARGET) + set(LOADER_DEPENDENCIES "") + + # Optional argument for template + if(${ARGV0}) + set(LOADER_CONFIGURATION_TEMPLATE "${ARGV0}") + else() + set(LOADER_CONFIGURATION_TEMPLATE "${LOADER_CONFIGURATION_DEFAULT_TEMPLATE}") + endif() + + set(LOADER_CONFIGURATION_TARGET "${TARGET}") +endmacro() + +# Generate configuration with dependencies for a loader +# +# node_loader: +# "node": [ "/path/to/libnode.so", "/alternative/path/to/libnode.so" ], +# +# c_loader: +# "libffi": [ ... ], +# "libclang": [ ... ], +# "libtcc": [ ... ] +macro(loader_configuration_deps LIBRARY) + # Add new line from previous dependency + if(NOT "${LOADER_DEPENDENCIES}" STREQUAL "") + string(APPEND LOADER_DEPENDENCIES ",\n\t\t") + endif() + + # Define the library + string(APPEND LOADER_DEPENDENCIES "\"${LIBRARY}\": [") + + # Define the paths + set(FIRST_ARGUMENT 0) + foreach(DEPENDENCY IN ITEMS ${ARGN}) + if(${FIRST_ARGUMENT} EQUAL 0) + # Set first path + string(APPEND LOADER_DEPENDENCIES "\"${DEPENDENCY}\"") + set(FIRST_ARGUMENT 1) + else() + # Set the rest of the paths + string(APPEND LOADER_DEPENDENCIES ", \"${DEPENDENCY}\"") + endif() + endforeach() + + # Finalize the list + string(APPEND LOADER_DEPENDENCIES "]") +endmacro() + +# Commit development version +macro(loader_configuartion_end_development) + if(NOT DEFINED LOADER_CONFIGURATION_TEMPLATE OR NOT DEFINED LOADER_CONFIGURATION_TARGET) + return() + endif() + + configure_file(${LOADER_CONFIGURATION_TEMPLATE} ${CONFIGURATION_DIR}/${LOADER_CONFIGURATION_TARGET}.json) + + unset(LOADER_DEPENDENCIES) + unset(LOADER_CONFIGURATION_TEMPLATE) + unset(LOADER_CONFIGURATION_TARGET) +endmacro() + +# Commit install version +macro(loader_configuartion_end_install) + if(NOT DEFINED LOADER_CONFIGURATION_TEMPLATE OR NOT DEFINED LOADER_CONFIGURATION_TARGET) + return() + endif() + + configure_file(${LOADER_CONFIGURATION_TEMPLATE} ${CONFIGURATION_DIR}/install/configurations/${LOADER_CONFIGURATION_TARGET}.json) + + unset(LOADER_DEPENDENCIES) + unset(LOADER_CONFIGURATION_TEMPLATE) + unset(LOADER_CONFIGURATION_TARGET) +endmacro() + +# Commit both versions +macro(loader_configuartion_end) + if(NOT DEFINED LOADER_CONFIGURATION_TEMPLATE OR NOT DEFINED LOADER_CONFIGURATION_TARGET) + return() + endif() + + configure_file(${LOADER_CONFIGURATION_TEMPLATE} ${CONFIGURATION_DIR}/${LOADER_CONFIGURATION_TARGET}.json) + configure_file(${LOADER_CONFIGURATION_TEMPLATE} ${CONFIGURATION_DIR}/install/configurations/${LOADER_CONFIGURATION_TARGET}.json) + + unset(LOADER_DEPENDENCIES) + unset(LOADER_CONFIGURATION_TEMPLATE) + unset(LOADER_CONFIGURATION_TARGET) +endmacro() + # Plugin packages add_subdirectory(c_loader) # Foreign Function Interface library add_subdirectory(cob_loader) # GNU/Cobol 2.2 Runtime @@ -49,34 +184,18 @@ add_subdirectory(rpc_loader) # cURL Remote Procedure Call add_subdirectory(ts_loader) # TypeScript 3.9.7 add_subdirectory(wasm_loader) # WebAssembly Virtual Machine -# Optionally enable loader dependencies utility -macro(add_loader_dependencies target) - set(loaders_map_c_loader OPTION_BUILD_LOADERS_C) - set(loaders_map_cob_loader OPTION_BUILD_LOADERS_COB) - set(loaders_map_cr_loader OPTION_BUILD_LOADERS_CR) - set(loaders_map_cs_loader OPTION_BUILD_LOADERS_DART) - set(loaders_map_dart_loader OPTION_BUILD_LOADERS_CS) - set(loaders_map_ext_loader OPTION_BUILD_LOADERS_EXT) - set(loaders_map_file_loader OPTION_BUILD_LOADERS_FILE) - set(loaders_map_java_loader OPTION_BUILD_LOADERS_JAVA) - set(loaders_map_jl_loader OPTION_BUILD_LOADERS_JL) - set(loaders_map_jsm_loader OPTION_BUILD_LOADERS_JSM) - set(loaders_map_js_loader OPTION_BUILD_LOADERS_JS) - set(loaders_map_llvm_loader OPTION_BUILD_LOADERS_LLVM) - set(loaders_map_lua_loader OPTION_BUILD_LOADERS_LUA) - set(loaders_map_mock_loader OPTION_BUILD_LOADERS_MOCK) - set(loaders_map_node_loader OPTION_BUILD_LOADERS_NODE) - set(loaders_map_py_loader OPTION_BUILD_LOADERS_PY) - set(loaders_map_rb_loader OPTION_BUILD_LOADERS_RB) - set(loaders_map_rs_loader OPTION_BUILD_LOADERS_RS) - set(loaders_map_rpc_loader OPTION_BUILD_LOADERS_RPC) - set(loaders_map_ts_loader OPTION_BUILD_LOADERS_TS) - set(loaders_map_wasm_loader OPTION_BUILD_LOADERS_WASM) - +# Optionally enable loader dependencies utility (for tests) +macro(add_loader_dependencies TARGET) set(LOADERS_LIST) - foreach(loader ${ARGN}) - if(${loaders_map_${loader}}) + foreach(LOADER ${ARGN}) + # Loaders come in the form of: py_loader, node_loader, ... + # Convert them into OPTION_BUILD_LOADERS_PY, OPTION_BUILD_LOADERS_NODE, ... + string(REPLACE "_loader" "" LOADER_TAG "${LOADER}") + string(TOUPPER "${LOADER_TAG}" LOADER_TAG) + + # Check if the loader is enabled + if(${OPTION_BUILD_LOADERS_${LOADER_TAG}}) set(LOADERS_LIST ${LOADERS_LIST} ${loader} @@ -85,6 +204,6 @@ macro(add_loader_dependencies target) endforeach() if(LOADERS_LIST) - add_dependencies(${target} ${LOADERS_LIST}) + add_dependencies(${TARGET} ${LOADERS_LIST}) endif() endmacro() diff --git a/source/loaders/cs_loader/CMakeLists.txt b/source/loaders/cs_loader/CMakeLists.txt index 3eedab81b..8486486e6 100644 --- a/source/loaders/cs_loader/CMakeLists.txt +++ b/source/loaders/cs_loader/CMakeLists.txt @@ -235,13 +235,18 @@ target_link_libraries(${target} # Configuration # +set(CS_LOADER_CONFIG_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/data/cs_loader.json.in") string(REPLACE "\\" "/" DOTNET_CORE_PATH "${DOTNET_CORE_PATH}") -set(DOTNET_CORE_LOADER_ASSEMBLY_PATH ${PROJECT_OUTPUT_DIR}/CSLoader.dll) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/cs_loader.json.in ${CONFIGURATION_DIR}/cs_loader.json) +# Development +loader_configuration_begin(cs_loader "${CS_LOADER_CONFIG_TEMPLATE}") +set(DOTNET_CORE_LOADER_ASSEMBLY_PATH ${PROJECT_OUTPUT_DIR}/CSLoader.dll) +loader_configuartion_end_development() -set(DOTNET_CORE_LOADER_ASSEMBLY_PATH ${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB}/CSLoader.dll) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/cs_loader.json.in ${CONFIGURATION_DIR}/install/configurations/cs_loader.json) +# Install +loader_configuration_begin(cs_loader "${CS_LOADER_CONFIG_TEMPLATE}") +set(DOTNET_CORE_LOADER_ASSEMBLY_PATH ${PROJECT_OUTPUT_DIR}/CSLoader.dll) +loader_configuartion_end_install() # # Deployment diff --git a/source/loaders/cs_loader/data/cs_loader.json.in b/source/loaders/cs_loader/data/cs_loader.json.in index b701dec8b..a570e0868 100644 --- a/source/loaders/cs_loader/data/cs_loader.json.in +++ b/source/loaders/cs_loader/data/cs_loader.json.in @@ -1,4 +1,4 @@ { - "dotnet_root":"@DOTNET_CORE_PATH@", - "dotnet_loader_assembly_path":"@DOTNET_CORE_LOADER_ASSEMBLY_PATH@" + "dotnet_root": "@DOTNET_CORE_PATH@", + "dotnet_loader_assembly_path": "@DOTNET_CORE_LOADER_ASSEMBLY_PATH@" } diff --git a/source/loaders/loader.json.in b/source/loaders/loader.json.in new file mode 100644 index 000000000..dfb183afd --- /dev/null +++ b/source/loaders/loader.json.in @@ -0,0 +1,5 @@ +{ + "dependencies": { + @LOADER_DEPENDENCIES@ + } +} diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index a9bf13c67..0a3b26775 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -157,9 +157,6 @@ target_link_libraries(${target} PRIVATE ${META_PROJECT_NAME}::metacall # MetaCall library - # TODO: Implement delayed load - ${NodeJS_LIBRARY} # NodeJS library - PUBLIC ${DEFAULT_LIBRARIES} @@ -227,6 +224,8 @@ install(TARGETS ${target} ARCHIVE DESTINATION ${INSTALL_LIB} COMPONENT dev ) +set(NodeJS_LIBRARY_DEVELOPMENT "${NodeJS_LIBRARY}") + # Runtime (pack NodeJS DLL in windows) # TODO: https://cmake.org/cmake/help/latest/command/file.html#get-runtime-dependencies # TODO: https://gist.github.com/micahsnyder/5d98ac8548b429309ec5a35bca9366da @@ -236,10 +235,32 @@ if(NodeJS_LIBRARY_NAME_PATH AND WIN32) DESTINATION ${INSTALL_LIB} COMPONENT runtime ) + + get_filename_component(NodeJS_LIBRARY_NAME "${NodeJS_LIBRARY_NAME_PATH}" NAME) + set(NodeJS_LIBRARY_INSTALL "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB}/${NodeJS_LIBRARY_NAME}") elseif(NodeJS_BUILD_FROM_SOURCE AND NOT WIN32) install(FILES "${NodeJS_LIBRARY}" DESTINATION ${INSTALL_LIB} COMPONENT runtime ) + + get_filename_component(NodeJS_LIBRARY_NAME "${NodeJS_LIBRARY}" NAME) + set(NodeJS_LIBRARY_INSTALL "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB}/${NodeJS_LIBRARY_NAME}") +else() + set(NodeJS_LIBRARY_INSTALL "${NodeJS_LIBRARY}") endif() + +# +# Configuration +# + +# Development +loader_configuration_begin(node_loader) +loader_configuration_deps(node "${NodeJS_LIBRARY_DEVELOPMENT}") +loader_configuartion_end_development() + +# Install +loader_configuration_begin(node_loader) +loader_configuration_deps(node "${NodeJS_LIBRARY_INSTALL}") +loader_configuartion_end_install() diff --git a/source/plugin/source/plugin_manager.c b/source/plugin/source/plugin_manager.c index f60155fe6..353eaded5 100644 --- a/source/plugin/source/plugin_manager.c +++ b/source/plugin/source/plugin_manager.c @@ -31,7 +31,7 @@ #include #if defined(WIN32) || defined(_WIN32) - #include + #include /* SetDllDirectoryA */ #endif /* -- Declarations -- */ From 3f53257980d9e60a6d6b5d8d492199d21c209e2a Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 30 Jan 2025 17:06:04 +0100 Subject: [PATCH 16/66] Use always Python3. --- source/tests/metacall_node_port_test/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/tests/metacall_node_port_test/CMakeLists.txt b/source/tests/metacall_node_port_test/CMakeLists.txt index 6ffc2981b..9c6c12b5b 100644 --- a/source/tests/metacall_node_port_test/CMakeLists.txt +++ b/source/tests/metacall_node_port_test/CMakeLists.txt @@ -193,15 +193,15 @@ add_dependencies(${target} set(NodeJS_EXECUTABLE_ONLY ON) find_package(NodeJS) -find_package(Python COMPONENTS Interpreter) +find_package(Python3 COMPONENTS Interpreter) -if(NodeJS_FOUND AND Python_Interpreter_FOUND) +if(NodeJS_FOUND AND Python3_Interpreter_FOUND) execute_process( COMMAND ${NodeJS_EXECUTABLE} -e "console.log(process.versions.openssl)" OUTPUT_VARIABLE NODEJS_OPENSSL_VERSION ) execute_process( - COMMAND ${Python_EXECUTABLE} -c "import ssl; print(ssl.OPENSSL_VERSION.split()[1])" + COMMAND ${Python3_EXECUTABLE} -c "import ssl; print(ssl.OPENSSL_VERSION.split()[1])" OUTPUT_VARIABLE PYTHON_OPENSSL_VERSION ) From 911e7a35b4db722075d342bd170444f9424cc224 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 30 Jan 2025 17:07:37 +0100 Subject: [PATCH 17/66] Solve issues Python 3.13. --- .../loaders/py_loader/source/py_loader_impl.c | 11 +++++++---- .../metacall_python_object_class_test.cpp | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/source/loaders/py_loader/source/py_loader_impl.c b/source/loaders/py_loader/source/py_loader_impl.c index 66be1c0b9..0c495ee07 100644 --- a/source/loaders/py_loader/source/py_loader_impl.c +++ b/source/loaders/py_loader/source/py_loader_impl.c @@ -685,7 +685,6 @@ int py_class_interface_static_set(klass cls, class_impl impl, struct accessor_ty (void)cls; loader_impl_py_class py_class = (loader_impl_py_class)impl; - PyObject *pyobject_class = py_class->cls; char *attr_name = attribute_name(accessor->data.attr); if (attr_name == NULL) @@ -695,15 +694,15 @@ int py_class_interface_static_set(klass cls, class_impl impl, struct accessor_ty py_loader_thread_acquire(); - PyObject *pyvalue = py_loader_impl_value_to_capi(py_class->impl, value_type_id(v), v); + PyObject *py_value = py_loader_impl_value_to_capi(py_class->impl, value_type_id(v), v); PyObject *key_py_str = PyUnicode_FromString(attr_name); - int retval = PyObject_GenericSetAttr(pyobject_class, key_py_str, pyvalue); + int result = PyObject_SetAttr(py_class->cls, key_py_str, py_value); Py_DECREF(key_py_str); py_loader_thread_release(); - return retval; + return result; } value py_class_interface_static_invoke(klass cls, class_impl impl, method m, class_args args, size_t argc) @@ -2640,7 +2639,11 @@ loader_impl_data py_loader_impl_initialize(loader_impl impl, configuration confi /* Hook the deallocation of PyCFunction */ py_loader_impl_pycfunction_dealloc = PyCFunction_Type.tp_dealloc; PyCFunction_Type.tp_dealloc = PyCFunction_dealloc; + + /* TODO: This does not work after 3.13, is it really needed for this hook? */ +#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 13 PyType_Modified(&PyCFunction_Type); +#endif if (py_loader_impl_initialize_sys_executable(py_impl) != 0) { diff --git a/source/tests/metacall_python_object_class_test/source/metacall_python_object_class_test.cpp b/source/tests/metacall_python_object_class_test/source/metacall_python_object_class_test.cpp index b1f6d18fb..a5a3439c2 100644 --- a/source/tests/metacall_python_object_class_test/source/metacall_python_object_class_test.cpp +++ b/source/tests/metacall_python_object_class_test/source/metacall_python_object_class_test.cpp @@ -149,6 +149,24 @@ TEST_F(metacall_python_class_test, DefaultConstructor) ASSERT_EQ((enum metacall_value_id)METACALL_STRING, (enum metacall_value_id)metacall_value_id(ret_value)); metacall_value_destroy(static_method_args[0]); metacall_value_destroy(ret_value); + + // Get and Set + void *param2 = metacall_class_static_get(myclass, "b"); + ASSERT_EQ((enum metacall_value_id)METACALL_LONG, (enum metacall_value_id)metacall_value_id(param2)); + ASSERT_EQ((long)44444L, (long)metacall_value_to_long(param2)); + + metacall_value_destroy(param2); + + void *long_value = metacall_value_create_long(5555L); + int retcode = metacall_class_static_set(myclass, "b", long_value); + metacall_value_destroy(long_value); + ASSERT_EQ((int)0, int(retcode)); + + param2 = metacall_class_static_get(myclass, "b"); + ASSERT_EQ((enum metacall_value_id)METACALL_LONG, (enum metacall_value_id)metacall_value_id(param2)); + ASSERT_EQ((long)5555L, (long)metacall_value_to_long(param2)); + + metacall_value_destroy(param2); } { From aa13d6ce0b94675f1f3a6cc7f8e4bc929b9004bb Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 30 Jan 2025 17:08:09 +0100 Subject: [PATCH 18/66] Implement dependencies for loaders. --- source/dynlink/include/dynlink/dynlink.h | 15 +++ source/dynlink/source/dynlink.c | 24 ++++ source/loader/include/loader/loader_impl.h | 2 + .../include/loader/loader_impl_interface.h | 2 - source/loader/source/loader.c | 7 ++ source/loader/source/loader_impl.c | 116 +++++++++++++----- source/loaders/CMakeLists.txt | 5 +- 7 files changed, 139 insertions(+), 32 deletions(-) diff --git a/source/dynlink/include/dynlink/dynlink.h b/source/dynlink/include/dynlink/dynlink.h index 77102c9e1..d1bdaf8d0 100644 --- a/source/dynlink/include/dynlink/dynlink.h +++ b/source/dynlink/include/dynlink/dynlink.h @@ -63,6 +63,21 @@ DYNLINK_API const char *dynlink_extension(void); */ DYNLINK_API dynlink dynlink_load(dynlink_path path, dynlink_name name, dynlink_flags flags); +/** +* @brief +* Load a dynamically linked shared object with absolute path +* +* @param[in] path +* Path where is located the shared object (absolute) +* +* @param[in] flags +* Dynamic linking flags +* +* @return +* A handle to the dynamically linked shared object +*/ +DYNLINK_API dynlink dynlink_load_absolute(dynlink_path path, dynlink_flags flags); + /** * @brief * Retreive the name of the dynamically linked shared object diff --git a/source/dynlink/source/dynlink.c b/source/dynlink/source/dynlink.c index 4ae3b801d..bc2a6b843 100644 --- a/source/dynlink/source/dynlink.c +++ b/source/dynlink/source/dynlink.c @@ -90,6 +90,30 @@ dynlink dynlink_load(dynlink_path path, dynlink_name name, dynlink_flags flags) return NULL; } +dynlink dynlink_load_absolute(dynlink_path path, dynlink_flags flags) +{ + dynlink handle = malloc(sizeof(struct dynlink_type)); + + if (handle == NULL) + { + return NULL; + } + + strncpy(handle->name_impl, path, strnlen(path, PORTABILITY_PATH_SIZE) + 1); + + handle->flags = flags; + + handle->impl = dynlink_impl_load(handle); + + if (handle->impl == NULL) + { + free(handle); + return NULL; + } + + return handle; +} + dynlink_name dynlink_get_name(dynlink handle) { if (handle != NULL) diff --git a/source/loader/include/loader/loader_impl.h b/source/loader/include/loader/loader_impl.h index 726cdf2ca..c4f6c8706 100644 --- a/source/loader/include/loader/loader_impl.h +++ b/source/loader/include/loader/loader_impl.h @@ -43,6 +43,8 @@ LOADER_API loader_impl loader_impl_create(const loader_tag tag); LOADER_API loader_impl loader_impl_create_host(const loader_tag tag); +LOADER_API int loader_impl_dependencies(loader_impl impl); + LOADER_API void loader_impl_attach(loader_impl impl, plugin p); LOADER_API plugin loader_impl_plugin(loader_impl impl); diff --git a/source/loader/include/loader/loader_impl_interface.h b/source/loader/include/loader/loader_impl_interface.h index 7033b2d5c..1e56f3ac8 100644 --- a/source/loader/include/loader/loader_impl_interface.h +++ b/source/loader/include/loader/loader_impl_interface.h @@ -35,8 +35,6 @@ extern "C" { #endif -#include - struct loader_impl_type; typedef struct loader_impl_type *loader_impl; diff --git a/source/loader/source/loader.c b/source/loader/source/loader.c index 73803e7ed..e29ef684f 100644 --- a/source/loader/source/loader.c +++ b/source/loader/source/loader.c @@ -264,6 +264,13 @@ plugin loader_get_impl_plugin(const loader_tag tag) goto loader_create_error; } + /* Dynamic link loader dependencies if it is not host */ + if (loader_impl_get_option_host(impl) == 0) + { + loader_impl_dependencies(impl); + } + + /* Dynamic link the loader */ p = plugin_manager_create(&loader_manager, tag, impl, &loader_impl_destroy_dtor); if (p == NULL) diff --git a/source/loader/source/loader_impl.c b/source/loader/source/loader_impl.c index 7d9bdbf4c..7db5c35d5 100644 --- a/source/loader/source/loader_impl.c +++ b/source/loader/source/loader_impl.c @@ -89,6 +89,7 @@ struct loader_impl_type set type_info_map; /* Stores a set indexed by type name of all of the types existing in the loader (global scope (TODO: may need refactor per handle)) */ value options; /* Additional initialization options passed in the initialize phase */ set exec_path_map; /* Set of execution paths passed by the end user */ + configuration config; /* Reference to the loader configuration, it contains execution_paths, dependencies and additional info */ }; struct loader_handle_impl_type @@ -119,7 +120,7 @@ struct loader_impl_metadata_cb_iterator_type static loader_impl loader_impl_allocate(const loader_tag tag); -static configuration loader_impl_initialize_configuration(plugin p); +static configuration loader_impl_initialize_configuration(const loader_tag tag); static int loader_impl_initialize_registered(plugin_manager manager, plugin p); @@ -258,50 +259,110 @@ plugin loader_impl_plugin(loader_impl impl) return NULL; } -void loader_impl_configuration(loader_impl_interface iface, loader_impl impl, configuration config) +void loader_impl_configuration_execution_paths(loader_impl_interface iface, loader_impl impl) { - value execution_paths_value = configuration_value_type(config, "execution_paths", TYPE_ARRAY); + value execution_paths_value = configuration_value_type(impl->config, "execution_paths", TYPE_ARRAY); if (execution_paths_value != NULL) { size_t size = value_type_count(execution_paths_value); value *execution_paths_array = value_to_array(execution_paths_value); + size_t iterator; - if (execution_paths_array != NULL) + for (iterator = 0; iterator < size; ++iterator) { - size_t iterator; + if (value_type_id(execution_paths_array[iterator]) == TYPE_STRING) + { + const char *str = value_to_string(execution_paths_array[iterator]); + size_t str_size = value_type_size(execution_paths_array[iterator]); + + if (str != NULL) + { + loader_path execution_path; + + strncpy(execution_path, str, str_size > LOADER_PATH_SIZE ? LOADER_PATH_SIZE : str_size); + + iface->execution_path(impl, execution_path); + } + } + } + } +} + +int loader_impl_dependencies(loader_impl impl) +{ + /* Dependencies have the following format */ + /* + { + "dependencies": { + "node": ["/usr/lib/x86_64-linux-gnu/libnode.so.72"] + } + } + */ + value dependencies_value = configuration_value_type(impl->config, "dependencies", TYPE_MAP); - for (iterator = 0; iterator < size; ++iterator) + if (dependencies_value != NULL) + { + size_t size = value_type_count(dependencies_value); + value *dependencies_map = value_to_map(dependencies_value); + size_t iterator; + + for (iterator = 0; iterator < size; ++iterator) + { + if (value_type_id(dependencies_map[iterator]) == TYPE_ARRAY) { - if (execution_paths_array[iterator] != NULL) + value *library_tuple = value_to_array(dependencies_map[iterator]); + + if (value_type_id(library_tuple[1]) == TYPE_ARRAY) { - const char *str = value_to_string(execution_paths_array[iterator]); - size_t str_size = value_type_size(execution_paths_array[iterator]); + value *paths_array = value_to_array(library_tuple[1]); + size_t paths_size = value_type_count(library_tuple[1]); + size_t path; + int found = 0; - if (str != NULL) + for (path = 0; path < paths_size; ++path) { - loader_path execution_path; + if (value_type_id(paths_array[iterator]) == TYPE_STRING) + { + const char *library_path = value_to_string(paths_array[iterator]); - strncpy(execution_path, str, str_size > LOADER_PATH_SIZE ? LOADER_PATH_SIZE : str_size); + if (library_path != NULL) + { + dynlink handle = dynlink_load_absolute(library_path, DYNLINK_FLAGS_BIND_LAZY | DYNLINK_FLAGS_BIND_GLOBAL); - iface->execution_path(impl, execution_path); + if (handle != NULL) + { + found = 1; + break; + } + } + } + } + + if (!found) + { + const char *dependency = value_type_id(library_tuple[0]) == TYPE_STRING ? value_to_string(library_tuple[0]) : "unknown_library"; + log_write("metacall", LOG_LEVEL_ERROR, "Failed to load dependency '%s' from loader configuration '%s.json'", dependency, plugin_name(impl->p)); + return 1; } } } } } + + return 0; } -configuration loader_impl_initialize_configuration(plugin p) +configuration loader_impl_initialize_configuration(const loader_tag tag) { static const char configuration_key_suffix[] = "_loader"; #define CONFIGURATION_KEY_SIZE ((size_t)sizeof(configuration_key_suffix) + LOADER_TAG_SIZE - 1) char configuration_key[CONFIGURATION_KEY_SIZE]; /* Retrieve the configuration key: _loader */ - size_t tag_size = strnlen(plugin_name(p), LOADER_TAG_SIZE) + 1; + size_t tag_size = strnlen(tag, LOADER_TAG_SIZE) + 1; - strncpy(configuration_key, plugin_name(p), tag_size); + strncpy(configuration_key, tag, tag_size); strncat(configuration_key, configuration_key_suffix, CONFIGURATION_KEY_SIZE - tag_size); #undef CONFIGURATION_KEY_SIZE @@ -331,7 +392,6 @@ int loader_impl_initialize_registered(plugin_manager manager, plugin p) int loader_impl_initialize(plugin_manager manager, plugin p, loader_impl impl) { static const char loader_library_path[] = "loader_library_path"; - configuration config; value loader_library_path_value = NULL; char *library_path = NULL; vector script_paths, paths; @@ -341,9 +401,6 @@ int loader_impl_initialize(plugin_manager manager, plugin p, loader_impl impl) return 0; } - /* Get the configuration of the loader */ - config = loader_impl_initialize_configuration(p); - /* Retrieve the library path */ library_path = plugin_manager_library_path(manager); @@ -355,19 +412,19 @@ int loader_impl_initialize(plugin_manager manager, plugin p, loader_impl impl) */ /* Check if the configuration has a custom loader_library_path, otherwise set it up */ - if (config != NULL && configuration_value_type(config, loader_library_path, TYPE_STRING) == NULL) + if (impl->config != NULL && configuration_value_type(impl->config, loader_library_path, TYPE_STRING) == NULL) { loader_library_path_value = value_create_string(library_path, strnlen(library_path, LOADER_PATH_SIZE)); - configuration_define(config, loader_library_path, loader_library_path_value); + configuration_define(impl->config, loader_library_path, loader_library_path_value); } /* Call to the loader initialize method */ - impl->data = loader_iface(p)->initialize(impl, config); + impl->data = loader_iface(p)->initialize(impl, impl->config); /* Undefine the library path field from config */ - if (config != NULL && loader_library_path_value != NULL) + if (impl->config != NULL && loader_library_path_value != NULL) { - configuration_undefine(config, loader_library_path); + configuration_undefine(impl->config, loader_library_path); value_type_destroy(loader_library_path_value); } @@ -390,9 +447,9 @@ int loader_impl_initialize(plugin_manager manager, plugin p, loader_impl impl) impl->init = 0; - if (config != NULL) + if (impl->config != NULL) { - loader_impl_configuration(loader_iface(p), impl, config); + loader_impl_configuration_execution_paths(loader_iface(p), impl); } /* The scripts path priority order is the following: @@ -402,7 +459,7 @@ int loader_impl_initialize(plugin_manager manager, plugin p, loader_impl impl) */ /* Load the library path as execution path */ - loader_library_path_value = configuration_value_type(config, loader_library_path, TYPE_STRING); + loader_library_path_value = configuration_value_type(impl->config, loader_library_path, TYPE_STRING); if (loader_library_path_value != NULL) { @@ -470,6 +527,9 @@ loader_impl loader_impl_create(const loader_tag tag) impl->init = 1; impl->options = NULL; + /* Get the configuration of the loader */ + impl->config = loader_impl_initialize_configuration(tag); + return impl; } diff --git a/source/loaders/CMakeLists.txt b/source/loaders/CMakeLists.txt index 2798d2722..edcb03e08 100644 --- a/source/loaders/CMakeLists.txt +++ b/source/loaders/CMakeLists.txt @@ -75,10 +75,11 @@ set(LOADER_CONFIGURATION_DEFAULT_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/loader.js # Define loader configuration for a specific loader macro(loader_configuration_begin TARGET) set(LOADER_DEPENDENCIES "") + set(OPTIONAL_TEMPLATE "${ARGV1}") # Optional argument for template - if(${ARGV0}) - set(LOADER_CONFIGURATION_TEMPLATE "${ARGV0}") + if(NOT "${ARGV1}" STREQUAL "") + set(LOADER_CONFIGURATION_TEMPLATE "${ARGV1}") else() set(LOADER_CONFIGURATION_TEMPLATE "${LOADER_CONFIGURATION_DEFAULT_TEMPLATE}") endif() From 1f4881607bd1b8d5afebc5f0c9c36946e98e16d3 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Mon, 3 Feb 2025 22:36:03 +0100 Subject: [PATCH 19/66] Change link options. --- source/adt/CMakeLists.txt | 2 +- source/benchmarks/log_bench/CMakeLists.txt | 2 +- source/benchmarks/metacall_cs_call_bench/CMakeLists.txt | 2 +- source/benchmarks/metacall_node_call_bench/CMakeLists.txt | 2 +- source/benchmarks/metacall_py_c_api_bench/CMakeLists.txt | 2 +- source/benchmarks/metacall_py_call_bench/CMakeLists.txt | 2 +- source/benchmarks/metacall_py_init_bench/CMakeLists.txt | 2 +- source/benchmarks/metacall_rb_call_bench/CMakeLists.txt | 2 +- source/cli/metacallcli/CMakeLists.txt | 2 +- source/cli/plugins/cli_core_plugin/CMakeLists.txt | 2 +- source/cli/plugins/cli_sandbox_plugin/CMakeLists.txt | 2 +- source/configuration/CMakeLists.txt | 2 +- source/detour/CMakeLists.txt | 2 +- source/detours/funchook_detour/CMakeLists.txt | 2 +- source/dynlink/CMakeLists.txt | 2 +- source/environment/CMakeLists.txt | 2 +- source/examples/metacallgui/CMakeLists.txt | 2 +- source/examples/metacalllog/CMakeLists.txt | 2 +- source/examples/metacallquine/CMakeLists.txt | 2 +- source/examples/metacallweb/CMakeLists.txt | 2 +- source/extensions/plugin_extension/CMakeLists.txt | 2 +- source/filesystem/CMakeLists.txt | 2 +- source/format/CMakeLists.txt | 2 +- source/loader/CMakeLists.txt | 2 +- source/loaders/c_loader/CMakeLists.txt | 2 +- source/loaders/cob_loader/CMakeLists.txt | 2 +- source/loaders/cr_loader/CMakeLists.txt | 2 +- source/loaders/cs_loader/CMakeLists.txt | 2 +- source/loaders/dart_loader/CMakeLists.txt | 2 +- source/loaders/ext_loader/CMakeLists.txt | 2 +- source/loaders/file_loader/CMakeLists.txt | 2 +- source/loaders/java_loader/CMakeLists.txt | 2 +- source/loaders/jl_loader/CMakeLists.txt | 2 +- source/loaders/js_loader/CMakeLists.txt | 2 +- source/loaders/jsm_loader/CMakeLists.txt | 2 +- source/loaders/llvm_loader/CMakeLists.txt | 2 +- source/loaders/lua_loader/CMakeLists.txt | 2 +- source/loaders/mock_loader/CMakeLists.txt | 2 +- source/loaders/node_loader/CMakeLists.txt | 7 ++++++- source/loaders/py_loader/CMakeLists.txt | 2 +- source/loaders/rb_loader/CMakeLists.txt | 2 +- source/loaders/rpc_loader/CMakeLists.txt | 2 +- source/loaders/rs_loader/CMakeLists.txt | 2 +- source/loaders/ts_loader/CMakeLists.txt | 2 +- source/loaders/wasm_loader/CMakeLists.txt | 2 +- source/log/CMakeLists.txt | 2 +- source/memory/CMakeLists.txt | 2 +- source/metacall/CMakeLists.txt | 2 +- source/plugin/CMakeLists.txt | 2 +- source/plugins/backtrace_plugin/CMakeLists.txt | 2 +- source/plugins/sandbox_plugin/CMakeLists.txt | 2 +- source/portability/CMakeLists.txt | 2 +- source/ports/cxx_port/CMakeLists.txt | 2 +- source/ports/js_port/CMakeLists.txt | 7 ++----- source/ports/rb_port/CMakeLists.txt | 3 +-- source/preprocessor/CMakeLists.txt | 2 +- source/reflect/CMakeLists.txt | 2 +- source/scripts/extension/sum/CMakeLists.txt | 2 +- source/serial/CMakeLists.txt | 2 +- source/serials/metacall_serial/CMakeLists.txt | 2 +- source/serials/rapid_json_serial/CMakeLists.txt | 2 +- source/tests/adt_map_test/CMakeLists.txt | 2 +- source/tests/adt_set_test/CMakeLists.txt | 2 +- source/tests/adt_trie_test/CMakeLists.txt | 2 +- source/tests/adt_vector_test/CMakeLists.txt | 2 +- source/tests/configuration_test/CMakeLists.txt | 2 +- source/tests/detour_test/CMakeLists.txt | 2 +- source/tests/dynlink_test/CMakeLists.txt | 2 +- source/tests/environment_test/CMakeLists.txt | 2 +- source/tests/log_custom_test/CMakeLists.txt | 2 +- source/tests/log_test/CMakeLists.txt | 2 +- source/tests/metacall_backtrace_plugin_test/CMakeLists.txt | 2 +- source/tests/metacall_c_lib_test/CMakeLists.txt | 2 +- source/tests/metacall_c_test/CMakeLists.txt | 2 +- source/tests/metacall_callback_complex_test/CMakeLists.txt | 2 +- source/tests/metacall_cast_test/CMakeLists.txt | 2 +- source/tests/metacall_clear_test/CMakeLists.txt | 2 +- .../metacall_cli_core_plugin_await_test/CMakeLists.txt | 2 +- source/tests/metacall_cli_core_plugin_test/CMakeLists.txt | 2 +- source/tests/metacall_cobol_test/CMakeLists.txt | 2 +- .../metacall_configuration_default_test/CMakeLists.txt | 2 +- .../metacall_configuration_exec_path_test/CMakeLists.txt | 2 +- source/tests/metacall_cs_test/CMakeLists.txt | 2 +- source/tests/metacall_csharp_function_test/CMakeLists.txt | 2 +- .../tests/metacall_csharp_static_class_test/CMakeLists.txt | 2 +- source/tests/metacall_depends_test/CMakeLists.txt | 2 +- source/tests/metacall_distributable_test/CMakeLists.txt | 2 +- source/tests/metacall_ducktype_test/CMakeLists.txt | 2 +- .../tests/metacall_duplicated_handle_test/CMakeLists.txt | 2 +- .../tests/metacall_duplicated_symbols_test/CMakeLists.txt | 2 +- source/tests/metacall_dynlink_path_test/CMakeLists.txt | 2 +- source/tests/metacall_ext_test/CMakeLists.txt | 2 +- source/tests/metacall_file_fail_test/CMakeLists.txt | 2 +- source/tests/metacall_file_glob_test/CMakeLists.txt | 2 +- source/tests/metacall_file_test/CMakeLists.txt | 2 +- source/tests/metacall_fork_test/CMakeLists.txt | 2 +- source/tests/metacall_function_test/CMakeLists.txt | 2 +- source/tests/metacall_handle_export_test/CMakeLists.txt | 2 +- source/tests/metacall_handle_get_test/CMakeLists.txt | 2 +- source/tests/metacall_init_fini_test/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- source/tests/metacall_initialize_ex_test/CMakeLists.txt | 2 +- source/tests/metacall_initialize_test/CMakeLists.txt | 2 +- source/tests/metacall_inspect_test/CMakeLists.txt | 2 +- source/tests/metacall_integration_test/CMakeLists.txt | 2 +- source/tests/metacall_invalid_loader_test/CMakeLists.txt | 2 +- source/tests/metacall_java_test/CMakeLists.txt | 2 +- source/tests/metacall_julia_test/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- source/tests/metacall_llvm_test/CMakeLists.txt | 2 +- .../metacall_load_configuration_fail_test/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../tests/metacall_load_configuration_test/CMakeLists.txt | 2 +- .../tests/metacall_load_memory_empty_test/CMakeLists.txt | 2 +- source/tests/metacall_load_memory_test/CMakeLists.txt | 2 +- source/tests/metacall_logs_test/CMakeLists.txt | 2 +- source/tests/metacall_lua_test/CMakeLists.txt | 2 +- source/tests/metacall_map_await_test/CMakeLists.txt | 2 +- source/tests/metacall_map_test/CMakeLists.txt | 2 +- .../tests/metacall_node_async_multiple_test/CMakeLists.txt | 2 +- .../metacall_node_async_resources_test/CMakeLists.txt | 2 +- source/tests/metacall_node_async_test/CMakeLists.txt | 2 +- source/tests/metacall_node_await_chain_test/CMakeLists.txt | 2 +- source/tests/metacall_node_call_test/CMakeLists.txt | 2 +- source/tests/metacall_node_callback_test/CMakeLists.txt | 2 +- source/tests/metacall_node_clear_mem_test/CMakeLists.txt | 2 +- .../tests/metacall_node_default_export_test/CMakeLists.txt | 2 +- .../metacall_node_event_loop_signal_test/CMakeLists.txt | 2 +- source/tests/metacall_node_event_loop_test/CMakeLists.txt | 2 +- source/tests/metacall_node_exception_test/CMakeLists.txt | 2 +- source/tests/metacall_node_extension_test/CMakeLists.txt | 2 +- .../node_extension_test/CMakeLists.txt | 2 +- .../tests/metacall_node_fail_env_var_test/CMakeLists.txt | 2 +- .../tests/metacall_node_fail_load_leak_test/CMakeLists.txt | 2 +- source/tests/metacall_node_fail_test/CMakeLists.txt | 2 +- source/tests/metacall_node_inline_test/CMakeLists.txt | 2 +- .../metacall_node_multithread_deadlock_test/CMakeLists.txt | 2 +- source/tests/metacall_node_native_code_test/CMakeLists.txt | 2 +- source/tests/metacall_node_port_await_test/CMakeLists.txt | 2 +- source/tests/metacall_node_port_c_lib_test/CMakeLists.txt | 2 +- source/tests/metacall_node_port_rs_test/CMakeLists.txt | 2 +- source/tests/metacall_node_port_test/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../tests/metacall_node_python_await_test/CMakeLists.txt | 2 +- .../metacall_node_python_deadlock_test/CMakeLists.txt | 2 +- .../metacall_node_python_exception_test/CMakeLists.txt | 2 +- .../metacall_node_python_port_mock_test/CMakeLists.txt | 2 +- .../metacall_node_python_port_ruby_test/CMakeLists.txt | 2 +- source/tests/metacall_node_python_ruby_test/CMakeLists.txt | 2 +- source/tests/metacall_node_reentrant_test/CMakeLists.txt | 2 +- .../tests/metacall_node_signal_handler_test/CMakeLists.txt | 2 +- source/tests/metacall_node_test/CMakeLists.txt | 2 +- source/tests/metacall_node_typescript_test/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../metacall_plugin_extension_local_test/CMakeLists.txt | 2 +- source/tests/metacall_plugin_extension_test/CMakeLists.txt | 2 +- source/tests/metacall_python_async_test/CMakeLists.txt | 2 +- source/tests/metacall_python_await_test/CMakeLists.txt | 2 +- source/tests/metacall_python_builtins_test/CMakeLists.txt | 2 +- source/tests/metacall_python_callback_test/CMakeLists.txt | 2 +- source/tests/metacall_python_dict_test/CMakeLists.txt | 2 +- source/tests/metacall_python_exception_test/CMakeLists.txt | 2 +- source/tests/metacall_python_fail_test/CMakeLists.txt | 2 +- source/tests/metacall_python_gc_test/CMakeLists.txt | 2 +- .../tests/metacall_python_loader_port_test/CMakeLists.txt | 2 +- source/tests/metacall_python_model_test/CMakeLists.txt | 2 +- .../tests/metacall_python_node_await_test/CMakeLists.txt | 2 +- .../tests/metacall_python_object_class_test/CMakeLists.txt | 2 +- source/tests/metacall_python_open_test/CMakeLists.txt | 2 +- source/tests/metacall_python_pointer_test/CMakeLists.txt | 2 +- .../metacall_python_port_callback_test/CMakeLists.txt | 2 +- .../tests/metacall_python_port_https_test/CMakeLists.txt | 2 +- .../tests/metacall_python_port_import_test/CMakeLists.txt | 2 +- .../tests/metacall_python_port_pointer_test/CMakeLists.txt | 2 +- source/tests/metacall_python_port_test/CMakeLists.txt | 2 +- source/tests/metacall_python_reentrant_test/CMakeLists.txt | 2 +- .../metacall_python_relative_path_test/CMakeLists.txt | 2 +- source/tests/metacall_python_test/CMakeLists.txt | 2 +- source/tests/metacall_python_varargs_test/CMakeLists.txt | 2 +- .../metacall_python_without_env_vars_test/CMakeLists.txt | 2 +- .../metacall_python_without_functions_test/CMakeLists.txt | 2 +- source/tests/metacall_reinitialize_test/CMakeLists.txt | 2 +- source/tests/metacall_reload_functions_test/CMakeLists.txt | 2 +- source/tests/metacall_return_monad_test/CMakeLists.txt | 2 +- source/tests/metacall_rpc_test/CMakeLists.txt | 2 +- source/tests/metacall_ruby_fail_empty_test/CMakeLists.txt | 2 +- source/tests/metacall_ruby_fail_test/CMakeLists.txt | 2 +- .../tests/metacall_ruby_object_class_test/CMakeLists.txt | 2 +- .../metacall_ruby_parser_integration_test/CMakeLists.txt | 2 +- .../metacall_ruby_rails_integration_test/CMakeLists.txt | 2 +- source/tests/metacall_ruby_test/CMakeLists.txt | 2 +- source/tests/metacall_rust_class_test/CMakeLists.txt | 2 +- .../tests/metacall_rust_load_from_mem_test/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../metacall_rust_load_from_package_test/CMakeLists.txt | 2 +- source/tests/metacall_rust_test/CMakeLists.txt | 2 +- source/tests/metacall_sandbox_plugin_test/CMakeLists.txt | 2 +- source/tests/metacall_test/CMakeLists.txt | 2 +- .../tests/metacall_typescript_call_map_test/CMakeLists.txt | 2 +- .../metacall_typescript_jsx_default_test/CMakeLists.txt | 2 +- source/tests/metacall_typescript_node_test/CMakeLists.txt | 2 +- .../tests/metacall_typescript_require_test/CMakeLists.txt | 2 +- source/tests/metacall_typescript_test/CMakeLists.txt | 2 +- .../metacall_typescript_tsx_loop_fail_test/CMakeLists.txt | 2 +- source/tests/metacall_typescript_tsx_test/CMakeLists.txt | 2 +- source/tests/metacall_version_test/CMakeLists.txt | 2 +- source/tests/metacall_wasm_python_port_test/CMakeLists.txt | 2 +- source/tests/metacall_wasm_test/CMakeLists.txt | 2 +- source/tests/portability_path_test/CMakeLists.txt | 2 +- source/tests/preprocessor_test/CMakeLists.txt | 2 +- source/tests/rb_loader_parser_test/CMakeLists.txt | 2 +- source/tests/reflect_function_test/CMakeLists.txt | 2 +- source/tests/reflect_metadata_test/CMakeLists.txt | 2 +- source/tests/reflect_object_class_test/CMakeLists.txt | 2 +- source/tests/reflect_scope_test/CMakeLists.txt | 2 +- source/tests/reflect_value_cast_test/CMakeLists.txt | 2 +- source/tests/serial_test/CMakeLists.txt | 2 +- source/threading/CMakeLists.txt | 2 +- source/version/CMakeLists.txt | 2 +- 225 files changed, 231 insertions(+), 230 deletions(-) diff --git a/source/adt/CMakeLists.txt b/source/adt/CMakeLists.txt index 122513f58..e97f2f59b 100644 --- a/source/adt/CMakeLists.txt +++ b/source/adt/CMakeLists.txt @@ -164,7 +164,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/benchmarks/log_bench/CMakeLists.txt b/source/benchmarks/log_bench/CMakeLists.txt index 63f7c901e..1c1175337 100644 --- a/source/benchmarks/log_bench/CMakeLists.txt +++ b/source/benchmarks/log_bench/CMakeLists.txt @@ -108,7 +108,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/benchmarks/metacall_cs_call_bench/CMakeLists.txt b/source/benchmarks/metacall_cs_call_bench/CMakeLists.txt index 618c9a7ee..751b4a034 100644 --- a/source/benchmarks/metacall_cs_call_bench/CMakeLists.txt +++ b/source/benchmarks/metacall_cs_call_bench/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/benchmarks/metacall_node_call_bench/CMakeLists.txt b/source/benchmarks/metacall_node_call_bench/CMakeLists.txt index 37aa30436..8b9c696bb 100644 --- a/source/benchmarks/metacall_node_call_bench/CMakeLists.txt +++ b/source/benchmarks/metacall_node_call_bench/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/benchmarks/metacall_py_c_api_bench/CMakeLists.txt b/source/benchmarks/metacall_py_c_api_bench/CMakeLists.txt index 1807f755a..0c0ee17bc 100644 --- a/source/benchmarks/metacall_py_c_api_bench/CMakeLists.txt +++ b/source/benchmarks/metacall_py_c_api_bench/CMakeLists.txt @@ -121,7 +121,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/benchmarks/metacall_py_call_bench/CMakeLists.txt b/source/benchmarks/metacall_py_call_bench/CMakeLists.txt index 898bddd69..bbc6b3376 100644 --- a/source/benchmarks/metacall_py_call_bench/CMakeLists.txt +++ b/source/benchmarks/metacall_py_call_bench/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/benchmarks/metacall_py_init_bench/CMakeLists.txt b/source/benchmarks/metacall_py_init_bench/CMakeLists.txt index 9933482d1..1aff472c3 100644 --- a/source/benchmarks/metacall_py_init_bench/CMakeLists.txt +++ b/source/benchmarks/metacall_py_init_bench/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/benchmarks/metacall_rb_call_bench/CMakeLists.txt b/source/benchmarks/metacall_rb_call_bench/CMakeLists.txt index 5643afe0b..fc66c3230 100644 --- a/source/benchmarks/metacall_rb_call_bench/CMakeLists.txt +++ b/source/benchmarks/metacall_rb_call_bench/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/cli/metacallcli/CMakeLists.txt b/source/cli/metacallcli/CMakeLists.txt index fe6679dc3..227a81cfd 100644 --- a/source/cli/metacallcli/CMakeLists.txt +++ b/source/cli/metacallcli/CMakeLists.txt @@ -139,7 +139,7 @@ target_compile_features(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/cli/plugins/cli_core_plugin/CMakeLists.txt b/source/cli/plugins/cli_core_plugin/CMakeLists.txt index 2dd38f06d..1e353e4d4 100644 --- a/source/cli/plugins/cli_core_plugin/CMakeLists.txt +++ b/source/cli/plugins/cli_core_plugin/CMakeLists.txt @@ -180,7 +180,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/cli/plugins/cli_sandbox_plugin/CMakeLists.txt b/source/cli/plugins/cli_sandbox_plugin/CMakeLists.txt index e4d16acd2..3c777caf8 100644 --- a/source/cli/plugins/cli_sandbox_plugin/CMakeLists.txt +++ b/source/cli/plugins/cli_sandbox_plugin/CMakeLists.txt @@ -175,7 +175,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/configuration/CMakeLists.txt b/source/configuration/CMakeLists.txt index 2332f0682..6c5204d8f 100644 --- a/source/configuration/CMakeLists.txt +++ b/source/configuration/CMakeLists.txt @@ -164,7 +164,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/detour/CMakeLists.txt b/source/detour/CMakeLists.txt index 0a8a4e5d7..fafc41c6f 100644 --- a/source/detour/CMakeLists.txt +++ b/source/detour/CMakeLists.txt @@ -157,7 +157,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index b9c304e1d..a822ca631 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -221,7 +221,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/dynlink/CMakeLists.txt b/source/dynlink/CMakeLists.txt index dbb770bec..33a62eaa7 100644 --- a/source/dynlink/CMakeLists.txt +++ b/source/dynlink/CMakeLists.txt @@ -168,7 +168,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/environment/CMakeLists.txt b/source/environment/CMakeLists.txt index 243a97849..34c36271b 100644 --- a/source/environment/CMakeLists.txt +++ b/source/environment/CMakeLists.txt @@ -150,7 +150,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/examples/metacallgui/CMakeLists.txt b/source/examples/metacallgui/CMakeLists.txt index 5ad975790..8bfa9b958 100644 --- a/source/examples/metacallgui/CMakeLists.txt +++ b/source/examples/metacallgui/CMakeLists.txt @@ -125,7 +125,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/examples/metacalllog/CMakeLists.txt b/source/examples/metacalllog/CMakeLists.txt index 5a4c04da4..5a180105b 100644 --- a/source/examples/metacalllog/CMakeLists.txt +++ b/source/examples/metacalllog/CMakeLists.txt @@ -93,7 +93,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/examples/metacallquine/CMakeLists.txt b/source/examples/metacallquine/CMakeLists.txt index 9254a6b79..299a45762 100644 --- a/source/examples/metacallquine/CMakeLists.txt +++ b/source/examples/metacallquine/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/examples/metacallweb/CMakeLists.txt b/source/examples/metacallweb/CMakeLists.txt index 7e6a5f7fe..b4e9c095d 100644 --- a/source/examples/metacallweb/CMakeLists.txt +++ b/source/examples/metacallweb/CMakeLists.txt @@ -99,7 +99,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/extensions/plugin_extension/CMakeLists.txt b/source/extensions/plugin_extension/CMakeLists.txt index 0ef36ecd1..6873958a2 100644 --- a/source/extensions/plugin_extension/CMakeLists.txt +++ b/source/extensions/plugin_extension/CMakeLists.txt @@ -161,7 +161,7 @@ target_compile_features(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/filesystem/CMakeLists.txt b/source/filesystem/CMakeLists.txt index 397193fde..472863df3 100644 --- a/source/filesystem/CMakeLists.txt +++ b/source/filesystem/CMakeLists.txt @@ -181,7 +181,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/format/CMakeLists.txt b/source/format/CMakeLists.txt index d9f880e1a..46d4ba545 100644 --- a/source/format/CMakeLists.txt +++ b/source/format/CMakeLists.txt @@ -147,7 +147,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loader/CMakeLists.txt b/source/loader/CMakeLists.txt index 852575a60..dad99a6b7 100644 --- a/source/loader/CMakeLists.txt +++ b/source/loader/CMakeLists.txt @@ -170,7 +170,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/c_loader/CMakeLists.txt b/source/loaders/c_loader/CMakeLists.txt index cc2c09210..729466872 100644 --- a/source/loaders/c_loader/CMakeLists.txt +++ b/source/loaders/c_loader/CMakeLists.txt @@ -203,7 +203,7 @@ target_compile_features(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/cob_loader/CMakeLists.txt b/source/loaders/cob_loader/CMakeLists.txt index cd0327d7c..19890f7d5 100644 --- a/source/loaders/cob_loader/CMakeLists.txt +++ b/source/loaders/cob_loader/CMakeLists.txt @@ -162,7 +162,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/cr_loader/CMakeLists.txt b/source/loaders/cr_loader/CMakeLists.txt index 9a40a3bef..b0ab7ba89 100644 --- a/source/loaders/cr_loader/CMakeLists.txt +++ b/source/loaders/cr_loader/CMakeLists.txt @@ -154,7 +154,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/cs_loader/CMakeLists.txt b/source/loaders/cs_loader/CMakeLists.txt index 8486486e6..c872d0f24 100644 --- a/source/loaders/cs_loader/CMakeLists.txt +++ b/source/loaders/cs_loader/CMakeLists.txt @@ -222,7 +222,7 @@ target_compile_features(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/dart_loader/CMakeLists.txt b/source/loaders/dart_loader/CMakeLists.txt index 7cff11bd5..6355e44cd 100644 --- a/source/loaders/dart_loader/CMakeLists.txt +++ b/source/loaders/dart_loader/CMakeLists.txt @@ -165,7 +165,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/ext_loader/CMakeLists.txt b/source/loaders/ext_loader/CMakeLists.txt index bb850b7ab..b2a9545f9 100644 --- a/source/loaders/ext_loader/CMakeLists.txt +++ b/source/loaders/ext_loader/CMakeLists.txt @@ -163,7 +163,7 @@ target_compile_features(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/file_loader/CMakeLists.txt b/source/loaders/file_loader/CMakeLists.txt index eac4491f7..0f03daec2 100644 --- a/source/loaders/file_loader/CMakeLists.txt +++ b/source/loaders/file_loader/CMakeLists.txt @@ -154,7 +154,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/java_loader/CMakeLists.txt b/source/loaders/java_loader/CMakeLists.txt index 7c26d1871..c9b4d5857 100644 --- a/source/loaders/java_loader/CMakeLists.txt +++ b/source/loaders/java_loader/CMakeLists.txt @@ -175,7 +175,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/jl_loader/CMakeLists.txt b/source/loaders/jl_loader/CMakeLists.txt index e7a4a3f81..8c1109f2f 100644 --- a/source/loaders/jl_loader/CMakeLists.txt +++ b/source/loaders/jl_loader/CMakeLists.txt @@ -180,7 +180,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/js_loader/CMakeLists.txt b/source/loaders/js_loader/CMakeLists.txt index e5a963fb0..dfa627ff9 100644 --- a/source/loaders/js_loader/CMakeLists.txt +++ b/source/loaders/js_loader/CMakeLists.txt @@ -171,7 +171,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/jsm_loader/CMakeLists.txt b/source/loaders/jsm_loader/CMakeLists.txt index 3993e4b1f..36accd7ed 100644 --- a/source/loaders/jsm_loader/CMakeLists.txt +++ b/source/loaders/jsm_loader/CMakeLists.txt @@ -169,7 +169,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/llvm_loader/CMakeLists.txt b/source/loaders/llvm_loader/CMakeLists.txt index 0b31d18fc..7755ecf18 100644 --- a/source/loaders/llvm_loader/CMakeLists.txt +++ b/source/loaders/llvm_loader/CMakeLists.txt @@ -169,7 +169,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/lua_loader/CMakeLists.txt b/source/loaders/lua_loader/CMakeLists.txt index bd1c7fd72..6a735bbd7 100644 --- a/source/loaders/lua_loader/CMakeLists.txt +++ b/source/loaders/lua_loader/CMakeLists.txt @@ -167,7 +167,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/mock_loader/CMakeLists.txt b/source/loaders/mock_loader/CMakeLists.txt index 72a8dfbcb..60cd93043 100644 --- a/source/loaders/mock_loader/CMakeLists.txt +++ b/source/loaders/mock_loader/CMakeLists.txt @@ -154,7 +154,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index 0a3b26775..d4af40596 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -157,6 +157,9 @@ target_link_libraries(${target} PRIVATE ${META_PROJECT_NAME}::metacall # MetaCall library + # TODO: Implement workaround to the problem: "PE32 file format does not support weak linkage" + # $<$:${NodeJS_LIBRARY}> # NodeJS library + PUBLIC ${DEFAULT_LIBRARIES} @@ -195,8 +198,10 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE + # TODO: MacOS + # $<$:-Wl,-undefined=dynamic_lookup> PUBLIC ${DEFAULT_LINKER_OPTIONS} diff --git a/source/loaders/py_loader/CMakeLists.txt b/source/loaders/py_loader/CMakeLists.txt index eed3658bc..105bfae2c 100644 --- a/source/loaders/py_loader/CMakeLists.txt +++ b/source/loaders/py_loader/CMakeLists.txt @@ -209,7 +209,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/rb_loader/CMakeLists.txt b/source/loaders/rb_loader/CMakeLists.txt index 787fb3a17..8259079b4 100644 --- a/source/loaders/rb_loader/CMakeLists.txt +++ b/source/loaders/rb_loader/CMakeLists.txt @@ -186,7 +186,7 @@ endif() # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/rpc_loader/CMakeLists.txt b/source/loaders/rpc_loader/CMakeLists.txt index 9ebdc58c0..c81839aef 100644 --- a/source/loaders/rpc_loader/CMakeLists.txt +++ b/source/loaders/rpc_loader/CMakeLists.txt @@ -171,7 +171,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/rs_loader/CMakeLists.txt b/source/loaders/rs_loader/CMakeLists.txt index e6b4bbcff..4c97cf599 100644 --- a/source/loaders/rs_loader/CMakeLists.txt +++ b/source/loaders/rs_loader/CMakeLists.txt @@ -177,7 +177,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/ts_loader/CMakeLists.txt b/source/loaders/ts_loader/CMakeLists.txt index 4869091dd..076f40dc7 100644 --- a/source/loaders/ts_loader/CMakeLists.txt +++ b/source/loaders/ts_loader/CMakeLists.txt @@ -164,7 +164,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/wasm_loader/CMakeLists.txt b/source/loaders/wasm_loader/CMakeLists.txt index 1dd721fec..20ada2d79 100644 --- a/source/loaders/wasm_loader/CMakeLists.txt +++ b/source/loaders/wasm_loader/CMakeLists.txt @@ -174,7 +174,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/log/CMakeLists.txt b/source/log/CMakeLists.txt index becaf85fb..79c9c9ff9 100644 --- a/source/log/CMakeLists.txt +++ b/source/log/CMakeLists.txt @@ -219,7 +219,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/memory/CMakeLists.txt b/source/memory/CMakeLists.txt index fa7b05c03..17a4b1b1c 100644 --- a/source/memory/CMakeLists.txt +++ b/source/memory/CMakeLists.txt @@ -161,7 +161,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/metacall/CMakeLists.txt b/source/metacall/CMakeLists.txt index 1ab5be1fa..e04b167e8 100644 --- a/source/metacall/CMakeLists.txt +++ b/source/metacall/CMakeLists.txt @@ -242,7 +242,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/plugin/CMakeLists.txt b/source/plugin/CMakeLists.txt index 168286404..c46756f36 100644 --- a/source/plugin/CMakeLists.txt +++ b/source/plugin/CMakeLists.txt @@ -163,7 +163,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/plugins/backtrace_plugin/CMakeLists.txt b/source/plugins/backtrace_plugin/CMakeLists.txt index e434b7303..866e7b923 100644 --- a/source/plugins/backtrace_plugin/CMakeLists.txt +++ b/source/plugins/backtrace_plugin/CMakeLists.txt @@ -216,7 +216,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/plugins/sandbox_plugin/CMakeLists.txt b/source/plugins/sandbox_plugin/CMakeLists.txt index 8d271bf3f..1197f9760 100644 --- a/source/plugins/sandbox_plugin/CMakeLists.txt +++ b/source/plugins/sandbox_plugin/CMakeLists.txt @@ -196,7 +196,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/portability/CMakeLists.txt b/source/portability/CMakeLists.txt index cf4af64c6..fab62a921 100644 --- a/source/portability/CMakeLists.txt +++ b/source/portability/CMakeLists.txt @@ -156,7 +156,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/ports/cxx_port/CMakeLists.txt b/source/ports/cxx_port/CMakeLists.txt index 076fe1bf1..07b94e752 100644 --- a/source/ports/cxx_port/CMakeLists.txt +++ b/source/ports/cxx_port/CMakeLists.txt @@ -147,7 +147,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/ports/js_port/CMakeLists.txt b/source/ports/js_port/CMakeLists.txt index bae7efb73..447e1fc10 100644 --- a/source/ports/js_port/CMakeLists.txt +++ b/source/ports/js_port/CMakeLists.txt @@ -213,11 +213,8 @@ target_compile_options(${SWIG_MODULE_${target}_REAL_NAME} # Linker options # -target_link_libraries(${SWIG_MODULE_${target}_REAL_NAME} +add_link_options(${SWIG_MODULE_${target}_REAL_NAME} PRIVATE - ${V8_LIBRARIES} # V8 libraries - - ${META_PROJECT_NAME}::metacall PUBLIC ${DEFAULT_LINKER_OPTIONS} @@ -383,7 +380,7 @@ target_compile_options(${js_port_test} # Linker options # -target_link_libraries(${js_port_test} +add_link_options(${js_port_test} PRIVATE PUBLIC diff --git a/source/ports/rb_port/CMakeLists.txt b/source/ports/rb_port/CMakeLists.txt index 1d2cbf5be..0e9e574fc 100644 --- a/source/ports/rb_port/CMakeLists.txt +++ b/source/ports/rb_port/CMakeLists.txt @@ -237,9 +237,8 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${SWIG_MODULE_${target}_REAL_NAME} +add_link_options(${SWIG_MODULE_${target}_REAL_NAME} PRIVATE - ${META_PROJECT_NAME}::metacall PUBLIC ${DEFAULT_LINKER_OPTIONS} diff --git a/source/preprocessor/CMakeLists.txt b/source/preprocessor/CMakeLists.txt index da28c94b7..e3c7016ad 100644 --- a/source/preprocessor/CMakeLists.txt +++ b/source/preprocessor/CMakeLists.txt @@ -179,7 +179,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/reflect/CMakeLists.txt b/source/reflect/CMakeLists.txt index ed13aa98b..04921ad52 100644 --- a/source/reflect/CMakeLists.txt +++ b/source/reflect/CMakeLists.txt @@ -203,7 +203,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/scripts/extension/sum/CMakeLists.txt b/source/scripts/extension/sum/CMakeLists.txt index 223a70066..c076de1e1 100644 --- a/source/scripts/extension/sum/CMakeLists.txt +++ b/source/scripts/extension/sum/CMakeLists.txt @@ -152,7 +152,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/serial/CMakeLists.txt b/source/serial/CMakeLists.txt index 6636295d7..9a7a5b1e1 100644 --- a/source/serial/CMakeLists.txt +++ b/source/serial/CMakeLists.txt @@ -158,7 +158,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/serials/metacall_serial/CMakeLists.txt b/source/serials/metacall_serial/CMakeLists.txt index 0a981ebd3..66160ee09 100644 --- a/source/serials/metacall_serial/CMakeLists.txt +++ b/source/serials/metacall_serial/CMakeLists.txt @@ -158,7 +158,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/serials/rapid_json_serial/CMakeLists.txt b/source/serials/rapid_json_serial/CMakeLists.txt index c3f1d0d0c..aa2b18935 100644 --- a/source/serials/rapid_json_serial/CMakeLists.txt +++ b/source/serials/rapid_json_serial/CMakeLists.txt @@ -191,7 +191,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/tests/adt_map_test/CMakeLists.txt b/source/tests/adt_map_test/CMakeLists.txt index 65c947a0c..45bca49c8 100644 --- a/source/tests/adt_map_test/CMakeLists.txt +++ b/source/tests/adt_map_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/adt_set_test/CMakeLists.txt b/source/tests/adt_set_test/CMakeLists.txt index b56b9e7d9..21972409d 100644 --- a/source/tests/adt_set_test/CMakeLists.txt +++ b/source/tests/adt_set_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/adt_trie_test/CMakeLists.txt b/source/tests/adt_trie_test/CMakeLists.txt index b59489c70..28305388b 100644 --- a/source/tests/adt_trie_test/CMakeLists.txt +++ b/source/tests/adt_trie_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/adt_vector_test/CMakeLists.txt b/source/tests/adt_vector_test/CMakeLists.txt index f01ad35d0..cc085cb1b 100644 --- a/source/tests/adt_vector_test/CMakeLists.txt +++ b/source/tests/adt_vector_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/configuration_test/CMakeLists.txt b/source/tests/configuration_test/CMakeLists.txt index 2e9e6d996..e749dc9c5 100644 --- a/source/tests/configuration_test/CMakeLists.txt +++ b/source/tests/configuration_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/detour_test/CMakeLists.txt b/source/tests/detour_test/CMakeLists.txt index b22067a44..1e96fa5a0 100644 --- a/source/tests/detour_test/CMakeLists.txt +++ b/source/tests/detour_test/CMakeLists.txt @@ -121,7 +121,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/dynlink_test/CMakeLists.txt b/source/tests/dynlink_test/CMakeLists.txt index f8375ae69..53718d407 100644 --- a/source/tests/dynlink_test/CMakeLists.txt +++ b/source/tests/dynlink_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/environment_test/CMakeLists.txt b/source/tests/environment_test/CMakeLists.txt index 2b314418b..7a7575d46 100644 --- a/source/tests/environment_test/CMakeLists.txt +++ b/source/tests/environment_test/CMakeLists.txt @@ -107,7 +107,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/log_custom_test/CMakeLists.txt b/source/tests/log_custom_test/CMakeLists.txt index f79f04b9d..4793ab64a 100644 --- a/source/tests/log_custom_test/CMakeLists.txt +++ b/source/tests/log_custom_test/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/log_test/CMakeLists.txt b/source/tests/log_test/CMakeLists.txt index dfcb40b5e..8fe8cca09 100644 --- a/source/tests/log_test/CMakeLists.txt +++ b/source/tests/log_test/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_backtrace_plugin_test/CMakeLists.txt b/source/tests/metacall_backtrace_plugin_test/CMakeLists.txt index 31ff00540..2d5ad256a 100644 --- a/source/tests/metacall_backtrace_plugin_test/CMakeLists.txt +++ b/source/tests/metacall_backtrace_plugin_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_c_lib_test/CMakeLists.txt b/source/tests/metacall_c_lib_test/CMakeLists.txt index 60b3157a2..d4d7aa561 100644 --- a/source/tests/metacall_c_lib_test/CMakeLists.txt +++ b/source/tests/metacall_c_lib_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_c_test/CMakeLists.txt b/source/tests/metacall_c_test/CMakeLists.txt index da8b42575..76188b304 100644 --- a/source/tests/metacall_c_test/CMakeLists.txt +++ b/source/tests/metacall_c_test/CMakeLists.txt @@ -124,7 +124,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_callback_complex_test/CMakeLists.txt b/source/tests/metacall_callback_complex_test/CMakeLists.txt index 2edd78b98..c6c54a96a 100644 --- a/source/tests/metacall_callback_complex_test/CMakeLists.txt +++ b/source/tests/metacall_callback_complex_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_cast_test/CMakeLists.txt b/source/tests/metacall_cast_test/CMakeLists.txt index 73c8f9d98..4880ebe39 100644 --- a/source/tests/metacall_cast_test/CMakeLists.txt +++ b/source/tests/metacall_cast_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_clear_test/CMakeLists.txt b/source/tests/metacall_clear_test/CMakeLists.txt index a40a1ebc9..32591ebc4 100644 --- a/source/tests/metacall_clear_test/CMakeLists.txt +++ b/source/tests/metacall_clear_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_cli_core_plugin_await_test/CMakeLists.txt b/source/tests/metacall_cli_core_plugin_await_test/CMakeLists.txt index 5c2f4b739..8bb9fa0bc 100644 --- a/source/tests/metacall_cli_core_plugin_await_test/CMakeLists.txt +++ b/source/tests/metacall_cli_core_plugin_await_test/CMakeLists.txt @@ -123,7 +123,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_cli_core_plugin_test/CMakeLists.txt b/source/tests/metacall_cli_core_plugin_test/CMakeLists.txt index 5da0b4cf3..1f50fb8ca 100644 --- a/source/tests/metacall_cli_core_plugin_test/CMakeLists.txt +++ b/source/tests/metacall_cli_core_plugin_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_cobol_test/CMakeLists.txt b/source/tests/metacall_cobol_test/CMakeLists.txt index 6dddd7b9f..1c66d2dd2 100644 --- a/source/tests/metacall_cobol_test/CMakeLists.txt +++ b/source/tests/metacall_cobol_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_configuration_default_test/CMakeLists.txt b/source/tests/metacall_configuration_default_test/CMakeLists.txt index f82aca6df..589eeb1d1 100644 --- a/source/tests/metacall_configuration_default_test/CMakeLists.txt +++ b/source/tests/metacall_configuration_default_test/CMakeLists.txt @@ -129,7 +129,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_configuration_exec_path_test/CMakeLists.txt b/source/tests/metacall_configuration_exec_path_test/CMakeLists.txt index da3bc94fa..af15809f2 100644 --- a/source/tests/metacall_configuration_exec_path_test/CMakeLists.txt +++ b/source/tests/metacall_configuration_exec_path_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_cs_test/CMakeLists.txt b/source/tests/metacall_cs_test/CMakeLists.txt index f92b705a7..5859e5a82 100644 --- a/source/tests/metacall_cs_test/CMakeLists.txt +++ b/source/tests/metacall_cs_test/CMakeLists.txt @@ -117,7 +117,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_csharp_function_test/CMakeLists.txt b/source/tests/metacall_csharp_function_test/CMakeLists.txt index 1d641d00d..e89890969 100644 --- a/source/tests/metacall_csharp_function_test/CMakeLists.txt +++ b/source/tests/metacall_csharp_function_test/CMakeLists.txt @@ -125,7 +125,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_csharp_static_class_test/CMakeLists.txt b/source/tests/metacall_csharp_static_class_test/CMakeLists.txt index 6280b8f98..1c43f950a 100644 --- a/source/tests/metacall_csharp_static_class_test/CMakeLists.txt +++ b/source/tests/metacall_csharp_static_class_test/CMakeLists.txt @@ -125,7 +125,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_depends_test/CMakeLists.txt b/source/tests/metacall_depends_test/CMakeLists.txt index c94dbeae7..4fab09eae 100644 --- a/source/tests/metacall_depends_test/CMakeLists.txt +++ b/source/tests/metacall_depends_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_distributable_test/CMakeLists.txt b/source/tests/metacall_distributable_test/CMakeLists.txt index bf924ad61..257189724 100644 --- a/source/tests/metacall_distributable_test/CMakeLists.txt +++ b/source/tests/metacall_distributable_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ducktype_test/CMakeLists.txt b/source/tests/metacall_ducktype_test/CMakeLists.txt index 61d3ac4bf..11eed7096 100644 --- a/source/tests/metacall_ducktype_test/CMakeLists.txt +++ b/source/tests/metacall_ducktype_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_duplicated_handle_test/CMakeLists.txt b/source/tests/metacall_duplicated_handle_test/CMakeLists.txt index c86f54169..12424e225 100644 --- a/source/tests/metacall_duplicated_handle_test/CMakeLists.txt +++ b/source/tests/metacall_duplicated_handle_test/CMakeLists.txt @@ -114,7 +114,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_duplicated_symbols_test/CMakeLists.txt b/source/tests/metacall_duplicated_symbols_test/CMakeLists.txt index c53907078..3b17aa0ac 100644 --- a/source/tests/metacall_duplicated_symbols_test/CMakeLists.txt +++ b/source/tests/metacall_duplicated_symbols_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_dynlink_path_test/CMakeLists.txt b/source/tests/metacall_dynlink_path_test/CMakeLists.txt index ecc76c6f7..722d234a7 100644 --- a/source/tests/metacall_dynlink_path_test/CMakeLists.txt +++ b/source/tests/metacall_dynlink_path_test/CMakeLists.txt @@ -115,7 +115,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ext_test/CMakeLists.txt b/source/tests/metacall_ext_test/CMakeLists.txt index e75e6ff9f..b80533149 100644 --- a/source/tests/metacall_ext_test/CMakeLists.txt +++ b/source/tests/metacall_ext_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_file_fail_test/CMakeLists.txt b/source/tests/metacall_file_fail_test/CMakeLists.txt index e58b57b69..7e8d50072 100644 --- a/source/tests/metacall_file_fail_test/CMakeLists.txt +++ b/source/tests/metacall_file_fail_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_file_glob_test/CMakeLists.txt b/source/tests/metacall_file_glob_test/CMakeLists.txt index fde9870d6..ae886d214 100644 --- a/source/tests/metacall_file_glob_test/CMakeLists.txt +++ b/source/tests/metacall_file_glob_test/CMakeLists.txt @@ -123,7 +123,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_file_test/CMakeLists.txt b/source/tests/metacall_file_test/CMakeLists.txt index ad378539d..5f1673554 100644 --- a/source/tests/metacall_file_test/CMakeLists.txt +++ b/source/tests/metacall_file_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_fork_test/CMakeLists.txt b/source/tests/metacall_fork_test/CMakeLists.txt index 34ebb8a12..d7f19ff1e 100644 --- a/source/tests/metacall_fork_test/CMakeLists.txt +++ b/source/tests/metacall_fork_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_function_test/CMakeLists.txt b/source/tests/metacall_function_test/CMakeLists.txt index ad6e4fe58..fbe8d14ea 100644 --- a/source/tests/metacall_function_test/CMakeLists.txt +++ b/source/tests/metacall_function_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_handle_export_test/CMakeLists.txt b/source/tests/metacall_handle_export_test/CMakeLists.txt index d734ebe09..7320e8e92 100644 --- a/source/tests/metacall_handle_export_test/CMakeLists.txt +++ b/source/tests/metacall_handle_export_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_handle_get_test/CMakeLists.txt b/source/tests/metacall_handle_get_test/CMakeLists.txt index dd5aa471e..7a6576f36 100644 --- a/source/tests/metacall_handle_get_test/CMakeLists.txt +++ b/source/tests/metacall_handle_get_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_init_fini_test/CMakeLists.txt b/source/tests/metacall_init_fini_test/CMakeLists.txt index 86f467105..4b75590d1 100644 --- a/source/tests/metacall_init_fini_test/CMakeLists.txt +++ b/source/tests/metacall_init_fini_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_initialize_destroy_multiple_node_test/CMakeLists.txt b/source/tests/metacall_initialize_destroy_multiple_node_test/CMakeLists.txt index b91de9c5c..65a685801 100644 --- a/source/tests/metacall_initialize_destroy_multiple_node_test/CMakeLists.txt +++ b/source/tests/metacall_initialize_destroy_multiple_node_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_initialize_destroy_multiple_test/CMakeLists.txt b/source/tests/metacall_initialize_destroy_multiple_test/CMakeLists.txt index 1fbd5c0e4..9b19bbb70 100644 --- a/source/tests/metacall_initialize_destroy_multiple_test/CMakeLists.txt +++ b/source/tests/metacall_initialize_destroy_multiple_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_initialize_ex_test/CMakeLists.txt b/source/tests/metacall_initialize_ex_test/CMakeLists.txt index 18d0f1e58..3aa9967e4 100644 --- a/source/tests/metacall_initialize_ex_test/CMakeLists.txt +++ b/source/tests/metacall_initialize_ex_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_initialize_test/CMakeLists.txt b/source/tests/metacall_initialize_test/CMakeLists.txt index 2d231d616..fb1b6abfb 100644 --- a/source/tests/metacall_initialize_test/CMakeLists.txt +++ b/source/tests/metacall_initialize_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_inspect_test/CMakeLists.txt b/source/tests/metacall_inspect_test/CMakeLists.txt index 7f5664fbb..3deb9cd29 100644 --- a/source/tests/metacall_inspect_test/CMakeLists.txt +++ b/source/tests/metacall_inspect_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_integration_test/CMakeLists.txt b/source/tests/metacall_integration_test/CMakeLists.txt index b3236cb02..7314bdebd 100644 --- a/source/tests/metacall_integration_test/CMakeLists.txt +++ b/source/tests/metacall_integration_test/CMakeLists.txt @@ -117,7 +117,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_invalid_loader_test/CMakeLists.txt b/source/tests/metacall_invalid_loader_test/CMakeLists.txt index 3d0941cba..d3d16ec7a 100644 --- a/source/tests/metacall_invalid_loader_test/CMakeLists.txt +++ b/source/tests/metacall_invalid_loader_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_java_test/CMakeLists.txt b/source/tests/metacall_java_test/CMakeLists.txt index b7e52cab4..b1e2810fa 100644 --- a/source/tests/metacall_java_test/CMakeLists.txt +++ b/source/tests/metacall_java_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_julia_test/CMakeLists.txt b/source/tests/metacall_julia_test/CMakeLists.txt index 701fb1b89..c5f59d1e9 100644 --- a/source/tests/metacall_julia_test/CMakeLists.txt +++ b/source/tests/metacall_julia_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_library_path_without_env_vars_test/CMakeLists.txt b/source/tests/metacall_library_path_without_env_vars_test/CMakeLists.txt index 1bc31a11a..552b2ecc2 100644 --- a/source/tests/metacall_library_path_without_env_vars_test/CMakeLists.txt +++ b/source/tests/metacall_library_path_without_env_vars_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_llvm_test/CMakeLists.txt b/source/tests/metacall_llvm_test/CMakeLists.txt index acc723fdc..31b0c3d35 100644 --- a/source/tests/metacall_llvm_test/CMakeLists.txt +++ b/source/tests/metacall_llvm_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_configuration_fail_test/CMakeLists.txt b/source/tests/metacall_load_configuration_fail_test/CMakeLists.txt index d25581f20..9d3f8e8ab 100644 --- a/source/tests/metacall_load_configuration_fail_test/CMakeLists.txt +++ b/source/tests/metacall_load_configuration_fail_test/CMakeLists.txt @@ -114,7 +114,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_configuration_node_python_test/CMakeLists.txt b/source/tests/metacall_load_configuration_node_python_test/CMakeLists.txt index cb1dcf870..86917f395 100644 --- a/source/tests/metacall_load_configuration_node_python_test/CMakeLists.txt +++ b/source/tests/metacall_load_configuration_node_python_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_configuration_python_node_test/CMakeLists.txt b/source/tests/metacall_load_configuration_python_node_test/CMakeLists.txt index 9191bf4f3..b7588a561 100644 --- a/source/tests/metacall_load_configuration_python_node_test/CMakeLists.txt +++ b/source/tests/metacall_load_configuration_python_node_test/CMakeLists.txt @@ -116,7 +116,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_configuration_relative_test/CMakeLists.txt b/source/tests/metacall_load_configuration_relative_test/CMakeLists.txt index efaabddc6..90d3754bc 100644 --- a/source/tests/metacall_load_configuration_relative_test/CMakeLists.txt +++ b/source/tests/metacall_load_configuration_relative_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_configuration_test/CMakeLists.txt b/source/tests/metacall_load_configuration_test/CMakeLists.txt index a37dec752..04dca70c3 100644 --- a/source/tests/metacall_load_configuration_test/CMakeLists.txt +++ b/source/tests/metacall_load_configuration_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_memory_empty_test/CMakeLists.txt b/source/tests/metacall_load_memory_empty_test/CMakeLists.txt index 0cb67b3d9..719056eae 100644 --- a/source/tests/metacall_load_memory_empty_test/CMakeLists.txt +++ b/source/tests/metacall_load_memory_empty_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_memory_test/CMakeLists.txt b/source/tests/metacall_load_memory_test/CMakeLists.txt index c85b9c10d..014b7823f 100644 --- a/source/tests/metacall_load_memory_test/CMakeLists.txt +++ b/source/tests/metacall_load_memory_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_logs_test/CMakeLists.txt b/source/tests/metacall_logs_test/CMakeLists.txt index 068c0cf21..514da4c48 100644 --- a/source/tests/metacall_logs_test/CMakeLists.txt +++ b/source/tests/metacall_logs_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_lua_test/CMakeLists.txt b/source/tests/metacall_lua_test/CMakeLists.txt index d8d2cfc01..164aeeb3c 100644 --- a/source/tests/metacall_lua_test/CMakeLists.txt +++ b/source/tests/metacall_lua_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_map_await_test/CMakeLists.txt b/source/tests/metacall_map_await_test/CMakeLists.txt index c70decf95..7cb62f098 100644 --- a/source/tests/metacall_map_await_test/CMakeLists.txt +++ b/source/tests/metacall_map_await_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_map_test/CMakeLists.txt b/source/tests/metacall_map_test/CMakeLists.txt index 72cbbcab0..ffe8d92c5 100644 --- a/source/tests/metacall_map_test/CMakeLists.txt +++ b/source/tests/metacall_map_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_async_multiple_test/CMakeLists.txt b/source/tests/metacall_node_async_multiple_test/CMakeLists.txt index 7fc6365c9..2e5f9a135 100644 --- a/source/tests/metacall_node_async_multiple_test/CMakeLists.txt +++ b/source/tests/metacall_node_async_multiple_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_async_resources_test/CMakeLists.txt b/source/tests/metacall_node_async_resources_test/CMakeLists.txt index f57aeb377..6fafa70d2 100644 --- a/source/tests/metacall_node_async_resources_test/CMakeLists.txt +++ b/source/tests/metacall_node_async_resources_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_async_test/CMakeLists.txt b/source/tests/metacall_node_async_test/CMakeLists.txt index 43e43eb6a..d6a4050aa 100644 --- a/source/tests/metacall_node_async_test/CMakeLists.txt +++ b/source/tests/metacall_node_async_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_await_chain_test/CMakeLists.txt b/source/tests/metacall_node_await_chain_test/CMakeLists.txt index 8fc2574d9..8b15b75da 100644 --- a/source/tests/metacall_node_await_chain_test/CMakeLists.txt +++ b/source/tests/metacall_node_await_chain_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_call_test/CMakeLists.txt b/source/tests/metacall_node_call_test/CMakeLists.txt index 1c86441a0..f0ac1da58 100644 --- a/source/tests/metacall_node_call_test/CMakeLists.txt +++ b/source/tests/metacall_node_call_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_callback_test/CMakeLists.txt b/source/tests/metacall_node_callback_test/CMakeLists.txt index 6c50252a1..1249cc38e 100644 --- a/source/tests/metacall_node_callback_test/CMakeLists.txt +++ b/source/tests/metacall_node_callback_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_clear_mem_test/CMakeLists.txt b/source/tests/metacall_node_clear_mem_test/CMakeLists.txt index 511ce96e6..c91655dc4 100644 --- a/source/tests/metacall_node_clear_mem_test/CMakeLists.txt +++ b/source/tests/metacall_node_clear_mem_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_default_export_test/CMakeLists.txt b/source/tests/metacall_node_default_export_test/CMakeLists.txt index 4e1f5477b..93468e1ad 100644 --- a/source/tests/metacall_node_default_export_test/CMakeLists.txt +++ b/source/tests/metacall_node_default_export_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_event_loop_signal_test/CMakeLists.txt b/source/tests/metacall_node_event_loop_signal_test/CMakeLists.txt index b47b5650d..7c2922950 100644 --- a/source/tests/metacall_node_event_loop_signal_test/CMakeLists.txt +++ b/source/tests/metacall_node_event_loop_signal_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_event_loop_test/CMakeLists.txt b/source/tests/metacall_node_event_loop_test/CMakeLists.txt index ddbf38c2c..a0d1ae8ce 100644 --- a/source/tests/metacall_node_event_loop_test/CMakeLists.txt +++ b/source/tests/metacall_node_event_loop_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_exception_test/CMakeLists.txt b/source/tests/metacall_node_exception_test/CMakeLists.txt index f203c824c..f2a47f44e 100644 --- a/source/tests/metacall_node_exception_test/CMakeLists.txt +++ b/source/tests/metacall_node_exception_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_extension_test/CMakeLists.txt b/source/tests/metacall_node_extension_test/CMakeLists.txt index 33c372ae8..538385f34 100644 --- a/source/tests/metacall_node_extension_test/CMakeLists.txt +++ b/source/tests/metacall_node_extension_test/CMakeLists.txt @@ -114,7 +114,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_extension_test/node_extension_test/CMakeLists.txt b/source/tests/metacall_node_extension_test/node_extension_test/CMakeLists.txt index 997208d44..ebd286752 100644 --- a/source/tests/metacall_node_extension_test/node_extension_test/CMakeLists.txt +++ b/source/tests/metacall_node_extension_test/node_extension_test/CMakeLists.txt @@ -173,7 +173,7 @@ target_compile_options(${target} # Linker options # -target_link_options(${target} +add_link_options(${target} PRIVATE $<$:/IGNORE:4199> $<$:/DELAYLOAD:${NodeJS_LIBRARY_NAME}> diff --git a/source/tests/metacall_node_fail_env_var_test/CMakeLists.txt b/source/tests/metacall_node_fail_env_var_test/CMakeLists.txt index 0e629197c..9125c4a7b 100644 --- a/source/tests/metacall_node_fail_env_var_test/CMakeLists.txt +++ b/source/tests/metacall_node_fail_env_var_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_fail_load_leak_test/CMakeLists.txt b/source/tests/metacall_node_fail_load_leak_test/CMakeLists.txt index 35d46706a..0477424f8 100644 --- a/source/tests/metacall_node_fail_load_leak_test/CMakeLists.txt +++ b/source/tests/metacall_node_fail_load_leak_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_fail_test/CMakeLists.txt b/source/tests/metacall_node_fail_test/CMakeLists.txt index cdb112b96..fe06183eb 100644 --- a/source/tests/metacall_node_fail_test/CMakeLists.txt +++ b/source/tests/metacall_node_fail_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_inline_test/CMakeLists.txt b/source/tests/metacall_node_inline_test/CMakeLists.txt index 8d86c00ca..9f7829362 100644 --- a/source/tests/metacall_node_inline_test/CMakeLists.txt +++ b/source/tests/metacall_node_inline_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_multithread_deadlock_test/CMakeLists.txt b/source/tests/metacall_node_multithread_deadlock_test/CMakeLists.txt index 314015302..c7c06a689 100644 --- a/source/tests/metacall_node_multithread_deadlock_test/CMakeLists.txt +++ b/source/tests/metacall_node_multithread_deadlock_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_native_code_test/CMakeLists.txt b/source/tests/metacall_node_native_code_test/CMakeLists.txt index e915ed3b7..59f982c4c 100644 --- a/source/tests/metacall_node_native_code_test/CMakeLists.txt +++ b/source/tests/metacall_node_native_code_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_port_await_test/CMakeLists.txt b/source/tests/metacall_node_port_await_test/CMakeLists.txt index 7afce5c27..1b87b2f23 100644 --- a/source/tests/metacall_node_port_await_test/CMakeLists.txt +++ b/source/tests/metacall_node_port_await_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_port_c_lib_test/CMakeLists.txt b/source/tests/metacall_node_port_c_lib_test/CMakeLists.txt index 0f4436b10..6fb0c363a 100644 --- a/source/tests/metacall_node_port_c_lib_test/CMakeLists.txt +++ b/source/tests/metacall_node_port_c_lib_test/CMakeLists.txt @@ -128,7 +128,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_port_rs_test/CMakeLists.txt b/source/tests/metacall_node_port_rs_test/CMakeLists.txt index 2882f8630..081c44abc 100644 --- a/source/tests/metacall_node_port_rs_test/CMakeLists.txt +++ b/source/tests/metacall_node_port_rs_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_port_test/CMakeLists.txt b/source/tests/metacall_node_port_test/CMakeLists.txt index 9c6c12b5b..2d83ab674 100644 --- a/source/tests/metacall_node_port_test/CMakeLists.txt +++ b/source/tests/metacall_node_port_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_async_after_destroy_test/CMakeLists.txt b/source/tests/metacall_node_python_async_after_destroy_test/CMakeLists.txt index f08873f6e..435ed2445 100644 --- a/source/tests/metacall_node_python_async_after_destroy_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_async_after_destroy_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_await_extended_test/CMakeLists.txt b/source/tests/metacall_node_python_await_extended_test/CMakeLists.txt index af1945174..6c88f35e3 100644 --- a/source/tests/metacall_node_python_await_extended_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_await_extended_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_await_test/CMakeLists.txt b/source/tests/metacall_node_python_await_test/CMakeLists.txt index 70da8a544..09f86f6ba 100644 --- a/source/tests/metacall_node_python_await_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_await_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_deadlock_test/CMakeLists.txt b/source/tests/metacall_node_python_deadlock_test/CMakeLists.txt index 4f2cd49f9..0e896b1dc 100644 --- a/source/tests/metacall_node_python_deadlock_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_deadlock_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_exception_test/CMakeLists.txt b/source/tests/metacall_node_python_exception_test/CMakeLists.txt index af4c39982..49aee2178 100644 --- a/source/tests/metacall_node_python_exception_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_exception_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_port_mock_test/CMakeLists.txt b/source/tests/metacall_node_python_port_mock_test/CMakeLists.txt index 2179b2e2b..5cee029fe 100644 --- a/source/tests/metacall_node_python_port_mock_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_port_mock_test/CMakeLists.txt @@ -116,7 +116,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_port_ruby_test/CMakeLists.txt b/source/tests/metacall_node_python_port_ruby_test/CMakeLists.txt index d6299a6ae..faa5e03e8 100644 --- a/source/tests/metacall_node_python_port_ruby_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_port_ruby_test/CMakeLists.txt @@ -116,7 +116,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_ruby_test/CMakeLists.txt b/source/tests/metacall_node_python_ruby_test/CMakeLists.txt index 20f09c16a..dbcd8c316 100644 --- a/source/tests/metacall_node_python_ruby_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_ruby_test/CMakeLists.txt @@ -122,7 +122,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_reentrant_test/CMakeLists.txt b/source/tests/metacall_node_reentrant_test/CMakeLists.txt index 02e497681..27cdea516 100644 --- a/source/tests/metacall_node_reentrant_test/CMakeLists.txt +++ b/source/tests/metacall_node_reentrant_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_signal_handler_test/CMakeLists.txt b/source/tests/metacall_node_signal_handler_test/CMakeLists.txt index 29cc2a68c..312d29679 100644 --- a/source/tests/metacall_node_signal_handler_test/CMakeLists.txt +++ b/source/tests/metacall_node_signal_handler_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_test/CMakeLists.txt b/source/tests/metacall_node_test/CMakeLists.txt index c5f3c1219..3c311060a 100644 --- a/source/tests/metacall_node_test/CMakeLists.txt +++ b/source/tests/metacall_node_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_typescript_test/CMakeLists.txt b/source/tests/metacall_node_typescript_test/CMakeLists.txt index 2a0c79ccc..4a80ab646 100644 --- a/source/tests/metacall_node_typescript_test/CMakeLists.txt +++ b/source/tests/metacall_node_typescript_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_plugin_extension_destroy_order_test/CMakeLists.txt b/source/tests/metacall_plugin_extension_destroy_order_test/CMakeLists.txt index c0d8779c4..29f56547c 100644 --- a/source/tests/metacall_plugin_extension_destroy_order_test/CMakeLists.txt +++ b/source/tests/metacall_plugin_extension_destroy_order_test/CMakeLists.txt @@ -122,7 +122,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_plugin_extension_invalid_path_test/CMakeLists.txt b/source/tests/metacall_plugin_extension_invalid_path_test/CMakeLists.txt index 65eec2ce2..a4328a9cc 100644 --- a/source/tests/metacall_plugin_extension_invalid_path_test/CMakeLists.txt +++ b/source/tests/metacall_plugin_extension_invalid_path_test/CMakeLists.txt @@ -115,7 +115,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_plugin_extension_local_test/CMakeLists.txt b/source/tests/metacall_plugin_extension_local_test/CMakeLists.txt index 3a96bccef..438ce9105 100644 --- a/source/tests/metacall_plugin_extension_local_test/CMakeLists.txt +++ b/source/tests/metacall_plugin_extension_local_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_plugin_extension_test/CMakeLists.txt b/source/tests/metacall_plugin_extension_test/CMakeLists.txt index 4c4bc887c..3b783b815 100644 --- a/source/tests/metacall_plugin_extension_test/CMakeLists.txt +++ b/source/tests/metacall_plugin_extension_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_async_test/CMakeLists.txt b/source/tests/metacall_python_async_test/CMakeLists.txt index a93607cc8..3438c0ff4 100644 --- a/source/tests/metacall_python_async_test/CMakeLists.txt +++ b/source/tests/metacall_python_async_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_await_test/CMakeLists.txt b/source/tests/metacall_python_await_test/CMakeLists.txt index 13cddb5d2..9e77a645c 100644 --- a/source/tests/metacall_python_await_test/CMakeLists.txt +++ b/source/tests/metacall_python_await_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_builtins_test/CMakeLists.txt b/source/tests/metacall_python_builtins_test/CMakeLists.txt index 2e13c4e70..8d99ccf6c 100644 --- a/source/tests/metacall_python_builtins_test/CMakeLists.txt +++ b/source/tests/metacall_python_builtins_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_callback_test/CMakeLists.txt b/source/tests/metacall_python_callback_test/CMakeLists.txt index eab775d3e..702009b82 100644 --- a/source/tests/metacall_python_callback_test/CMakeLists.txt +++ b/source/tests/metacall_python_callback_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_dict_test/CMakeLists.txt b/source/tests/metacall_python_dict_test/CMakeLists.txt index ed59ef059..0f08317ff 100644 --- a/source/tests/metacall_python_dict_test/CMakeLists.txt +++ b/source/tests/metacall_python_dict_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_exception_test/CMakeLists.txt b/source/tests/metacall_python_exception_test/CMakeLists.txt index 85f131f27..904d8a573 100644 --- a/source/tests/metacall_python_exception_test/CMakeLists.txt +++ b/source/tests/metacall_python_exception_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_fail_test/CMakeLists.txt b/source/tests/metacall_python_fail_test/CMakeLists.txt index 73c4b15a8..b8950664c 100644 --- a/source/tests/metacall_python_fail_test/CMakeLists.txt +++ b/source/tests/metacall_python_fail_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_gc_test/CMakeLists.txt b/source/tests/metacall_python_gc_test/CMakeLists.txt index 01d197ada..4155fec42 100644 --- a/source/tests/metacall_python_gc_test/CMakeLists.txt +++ b/source/tests/metacall_python_gc_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_loader_port_test/CMakeLists.txt b/source/tests/metacall_python_loader_port_test/CMakeLists.txt index e1c2b3f45..63bcdad97 100644 --- a/source/tests/metacall_python_loader_port_test/CMakeLists.txt +++ b/source/tests/metacall_python_loader_port_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_model_test/CMakeLists.txt b/source/tests/metacall_python_model_test/CMakeLists.txt index d7d554d84..86155738c 100644 --- a/source/tests/metacall_python_model_test/CMakeLists.txt +++ b/source/tests/metacall_python_model_test/CMakeLists.txt @@ -122,7 +122,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_node_await_test/CMakeLists.txt b/source/tests/metacall_python_node_await_test/CMakeLists.txt index 4b2cb58b3..b4cf36b3c 100644 --- a/source/tests/metacall_python_node_await_test/CMakeLists.txt +++ b/source/tests/metacall_python_node_await_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_object_class_test/CMakeLists.txt b/source/tests/metacall_python_object_class_test/CMakeLists.txt index 0fb055b61..71dea28cf 100644 --- a/source/tests/metacall_python_object_class_test/CMakeLists.txt +++ b/source/tests/metacall_python_object_class_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_open_test/CMakeLists.txt b/source/tests/metacall_python_open_test/CMakeLists.txt index 2011c17a7..8569b85cd 100644 --- a/source/tests/metacall_python_open_test/CMakeLists.txt +++ b/source/tests/metacall_python_open_test/CMakeLists.txt @@ -131,7 +131,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_pointer_test/CMakeLists.txt b/source/tests/metacall_python_pointer_test/CMakeLists.txt index 911c8d2e8..9c807909a 100644 --- a/source/tests/metacall_python_pointer_test/CMakeLists.txt +++ b/source/tests/metacall_python_pointer_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_port_callback_test/CMakeLists.txt b/source/tests/metacall_python_port_callback_test/CMakeLists.txt index c2d356b14..6ba38e2c5 100644 --- a/source/tests/metacall_python_port_callback_test/CMakeLists.txt +++ b/source/tests/metacall_python_port_callback_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_port_https_test/CMakeLists.txt b/source/tests/metacall_python_port_https_test/CMakeLists.txt index 5760efabc..961f0af9a 100644 --- a/source/tests/metacall_python_port_https_test/CMakeLists.txt +++ b/source/tests/metacall_python_port_https_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_port_import_test/CMakeLists.txt b/source/tests/metacall_python_port_import_test/CMakeLists.txt index 68b706515..285dea5cc 100644 --- a/source/tests/metacall_python_port_import_test/CMakeLists.txt +++ b/source/tests/metacall_python_port_import_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_port_pointer_test/CMakeLists.txt b/source/tests/metacall_python_port_pointer_test/CMakeLists.txt index d421bdbe7..55188da8f 100644 --- a/source/tests/metacall_python_port_pointer_test/CMakeLists.txt +++ b/source/tests/metacall_python_port_pointer_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_port_test/CMakeLists.txt b/source/tests/metacall_python_port_test/CMakeLists.txt index ca0c027db..1caa130fa 100644 --- a/source/tests/metacall_python_port_test/CMakeLists.txt +++ b/source/tests/metacall_python_port_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_reentrant_test/CMakeLists.txt b/source/tests/metacall_python_reentrant_test/CMakeLists.txt index 727a99c1d..f196c4f9d 100644 --- a/source/tests/metacall_python_reentrant_test/CMakeLists.txt +++ b/source/tests/metacall_python_reentrant_test/CMakeLists.txt @@ -114,7 +114,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_relative_path_test/CMakeLists.txt b/source/tests/metacall_python_relative_path_test/CMakeLists.txt index 667570f67..e6ddb6028 100644 --- a/source/tests/metacall_python_relative_path_test/CMakeLists.txt +++ b/source/tests/metacall_python_relative_path_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_test/CMakeLists.txt b/source/tests/metacall_python_test/CMakeLists.txt index 6302b85c2..77631a1fe 100644 --- a/source/tests/metacall_python_test/CMakeLists.txt +++ b/source/tests/metacall_python_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_varargs_test/CMakeLists.txt b/source/tests/metacall_python_varargs_test/CMakeLists.txt index 4fa048b64..9143fc44e 100644 --- a/source/tests/metacall_python_varargs_test/CMakeLists.txt +++ b/source/tests/metacall_python_varargs_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_without_env_vars_test/CMakeLists.txt b/source/tests/metacall_python_without_env_vars_test/CMakeLists.txt index 5ffd8ffed..1a100f4ad 100644 --- a/source/tests/metacall_python_without_env_vars_test/CMakeLists.txt +++ b/source/tests/metacall_python_without_env_vars_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_without_functions_test/CMakeLists.txt b/source/tests/metacall_python_without_functions_test/CMakeLists.txt index 47b97fb0a..540595104 100644 --- a/source/tests/metacall_python_without_functions_test/CMakeLists.txt +++ b/source/tests/metacall_python_without_functions_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_reinitialize_test/CMakeLists.txt b/source/tests/metacall_reinitialize_test/CMakeLists.txt index 82aa0d962..f57b6b85f 100644 --- a/source/tests/metacall_reinitialize_test/CMakeLists.txt +++ b/source/tests/metacall_reinitialize_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_reload_functions_test/CMakeLists.txt b/source/tests/metacall_reload_functions_test/CMakeLists.txt index 07845beb4..4474e902e 100644 --- a/source/tests/metacall_reload_functions_test/CMakeLists.txt +++ b/source/tests/metacall_reload_functions_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_return_monad_test/CMakeLists.txt b/source/tests/metacall_return_monad_test/CMakeLists.txt index 94aa6644f..91874ed62 100644 --- a/source/tests/metacall_return_monad_test/CMakeLists.txt +++ b/source/tests/metacall_return_monad_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rpc_test/CMakeLists.txt b/source/tests/metacall_rpc_test/CMakeLists.txt index 78553d0e8..8fef52d0f 100644 --- a/source/tests/metacall_rpc_test/CMakeLists.txt +++ b/source/tests/metacall_rpc_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ruby_fail_empty_test/CMakeLists.txt b/source/tests/metacall_ruby_fail_empty_test/CMakeLists.txt index 588142060..1fe56e79a 100644 --- a/source/tests/metacall_ruby_fail_empty_test/CMakeLists.txt +++ b/source/tests/metacall_ruby_fail_empty_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ruby_fail_test/CMakeLists.txt b/source/tests/metacall_ruby_fail_test/CMakeLists.txt index 375bfffee..211d238b3 100644 --- a/source/tests/metacall_ruby_fail_test/CMakeLists.txt +++ b/source/tests/metacall_ruby_fail_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ruby_object_class_test/CMakeLists.txt b/source/tests/metacall_ruby_object_class_test/CMakeLists.txt index 3467e7165..fc9e50765 100644 --- a/source/tests/metacall_ruby_object_class_test/CMakeLists.txt +++ b/source/tests/metacall_ruby_object_class_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ruby_parser_integration_test/CMakeLists.txt b/source/tests/metacall_ruby_parser_integration_test/CMakeLists.txt index 9cabe6b27..e933746a3 100644 --- a/source/tests/metacall_ruby_parser_integration_test/CMakeLists.txt +++ b/source/tests/metacall_ruby_parser_integration_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ruby_rails_integration_test/CMakeLists.txt b/source/tests/metacall_ruby_rails_integration_test/CMakeLists.txt index fd57bc523..3f19f74b4 100644 --- a/source/tests/metacall_ruby_rails_integration_test/CMakeLists.txt +++ b/source/tests/metacall_ruby_rails_integration_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ruby_test/CMakeLists.txt b/source/tests/metacall_ruby_test/CMakeLists.txt index e954b12fd..267af49c8 100644 --- a/source/tests/metacall_ruby_test/CMakeLists.txt +++ b/source/tests/metacall_ruby_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rust_class_test/CMakeLists.txt b/source/tests/metacall_rust_class_test/CMakeLists.txt index 46e5e8953..c968d3174 100644 --- a/source/tests/metacall_rust_class_test/CMakeLists.txt +++ b/source/tests/metacall_rust_class_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rust_load_from_mem_test/CMakeLists.txt b/source/tests/metacall_rust_load_from_mem_test/CMakeLists.txt index e873e59af..46488ba4d 100644 --- a/source/tests/metacall_rust_load_from_mem_test/CMakeLists.txt +++ b/source/tests/metacall_rust_load_from_mem_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rust_load_from_package_class_test/CMakeLists.txt b/source/tests/metacall_rust_load_from_package_class_test/CMakeLists.txt index 1d06c81f3..757198c39 100644 --- a/source/tests/metacall_rust_load_from_package_class_test/CMakeLists.txt +++ b/source/tests/metacall_rust_load_from_package_class_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rust_load_from_package_dep_test/CMakeLists.txt b/source/tests/metacall_rust_load_from_package_dep_test/CMakeLists.txt index 4c4e3d8b9..3b47f2f3e 100644 --- a/source/tests/metacall_rust_load_from_package_dep_test/CMakeLists.txt +++ b/source/tests/metacall_rust_load_from_package_dep_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rust_load_from_package_test/CMakeLists.txt b/source/tests/metacall_rust_load_from_package_test/CMakeLists.txt index 8a938e300..c77fcfa35 100644 --- a/source/tests/metacall_rust_load_from_package_test/CMakeLists.txt +++ b/source/tests/metacall_rust_load_from_package_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rust_test/CMakeLists.txt b/source/tests/metacall_rust_test/CMakeLists.txt index c868f44c3..543fac1de 100644 --- a/source/tests/metacall_rust_test/CMakeLists.txt +++ b/source/tests/metacall_rust_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_sandbox_plugin_test/CMakeLists.txt b/source/tests/metacall_sandbox_plugin_test/CMakeLists.txt index e6c39e792..351a271b7 100644 --- a/source/tests/metacall_sandbox_plugin_test/CMakeLists.txt +++ b/source/tests/metacall_sandbox_plugin_test/CMakeLists.txt @@ -127,7 +127,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_test/CMakeLists.txt b/source/tests/metacall_test/CMakeLists.txt index b9afa8da8..932f43008 100644 --- a/source/tests/metacall_test/CMakeLists.txt +++ b/source/tests/metacall_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_call_map_test/CMakeLists.txt b/source/tests/metacall_typescript_call_map_test/CMakeLists.txt index 2d60cbe62..55f940a6f 100644 --- a/source/tests/metacall_typescript_call_map_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_call_map_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_jsx_default_test/CMakeLists.txt b/source/tests/metacall_typescript_jsx_default_test/CMakeLists.txt index 3f76973e6..1f88419a8 100644 --- a/source/tests/metacall_typescript_jsx_default_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_jsx_default_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_node_test/CMakeLists.txt b/source/tests/metacall_typescript_node_test/CMakeLists.txt index b6347d049..ba02a30ff 100644 --- a/source/tests/metacall_typescript_node_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_node_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_require_test/CMakeLists.txt b/source/tests/metacall_typescript_require_test/CMakeLists.txt index 48af41357..7ac9c1033 100644 --- a/source/tests/metacall_typescript_require_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_require_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_test/CMakeLists.txt b/source/tests/metacall_typescript_test/CMakeLists.txt index 73b56edcd..92ac58a70 100644 --- a/source/tests/metacall_typescript_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_tsx_loop_fail_test/CMakeLists.txt b/source/tests/metacall_typescript_tsx_loop_fail_test/CMakeLists.txt index 0eab47ceb..f88d202b5 100644 --- a/source/tests/metacall_typescript_tsx_loop_fail_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_tsx_loop_fail_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_tsx_test/CMakeLists.txt b/source/tests/metacall_typescript_tsx_test/CMakeLists.txt index 2be3b225b..2f1c5273f 100644 --- a/source/tests/metacall_typescript_tsx_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_tsx_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_version_test/CMakeLists.txt b/source/tests/metacall_version_test/CMakeLists.txt index f519f674e..1b89dd1e8 100644 --- a/source/tests/metacall_version_test/CMakeLists.txt +++ b/source/tests/metacall_version_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_wasm_python_port_test/CMakeLists.txt b/source/tests/metacall_wasm_python_port_test/CMakeLists.txt index 988752170..e179a04e1 100644 --- a/source/tests/metacall_wasm_python_port_test/CMakeLists.txt +++ b/source/tests/metacall_wasm_python_port_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_wasm_test/CMakeLists.txt b/source/tests/metacall_wasm_test/CMakeLists.txt index 2d1d0b0f3..8a928bef8 100644 --- a/source/tests/metacall_wasm_test/CMakeLists.txt +++ b/source/tests/metacall_wasm_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/portability_path_test/CMakeLists.txt b/source/tests/portability_path_test/CMakeLists.txt index bc736b07d..ea98857af 100644 --- a/source/tests/portability_path_test/CMakeLists.txt +++ b/source/tests/portability_path_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/preprocessor_test/CMakeLists.txt b/source/tests/preprocessor_test/CMakeLists.txt index f6533c008..17efabee8 100644 --- a/source/tests/preprocessor_test/CMakeLists.txt +++ b/source/tests/preprocessor_test/CMakeLists.txt @@ -106,7 +106,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/rb_loader_parser_test/CMakeLists.txt b/source/tests/rb_loader_parser_test/CMakeLists.txt index 3242839e2..30cb37c5a 100644 --- a/source/tests/rb_loader_parser_test/CMakeLists.txt +++ b/source/tests/rb_loader_parser_test/CMakeLists.txt @@ -125,7 +125,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/reflect_function_test/CMakeLists.txt b/source/tests/reflect_function_test/CMakeLists.txt index 3a7ae3a80..202dca6ac 100644 --- a/source/tests/reflect_function_test/CMakeLists.txt +++ b/source/tests/reflect_function_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/reflect_metadata_test/CMakeLists.txt b/source/tests/reflect_metadata_test/CMakeLists.txt index 375080bea..07291ac50 100644 --- a/source/tests/reflect_metadata_test/CMakeLists.txt +++ b/source/tests/reflect_metadata_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/reflect_object_class_test/CMakeLists.txt b/source/tests/reflect_object_class_test/CMakeLists.txt index 6b515aec6..14d331f17 100644 --- a/source/tests/reflect_object_class_test/CMakeLists.txt +++ b/source/tests/reflect_object_class_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/reflect_scope_test/CMakeLists.txt b/source/tests/reflect_scope_test/CMakeLists.txt index ba08a0cd7..dfb712094 100644 --- a/source/tests/reflect_scope_test/CMakeLists.txt +++ b/source/tests/reflect_scope_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/reflect_value_cast_test/CMakeLists.txt b/source/tests/reflect_value_cast_test/CMakeLists.txt index aa40caae6..616715e7f 100644 --- a/source/tests/reflect_value_cast_test/CMakeLists.txt +++ b/source/tests/reflect_value_cast_test/CMakeLists.txt @@ -125,7 +125,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/serial_test/CMakeLists.txt b/source/tests/serial_test/CMakeLists.txt index 2cf1c6bce..eb56ea1e1 100644 --- a/source/tests/serial_test/CMakeLists.txt +++ b/source/tests/serial_test/CMakeLists.txt @@ -124,7 +124,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/threading/CMakeLists.txt b/source/threading/CMakeLists.txt index a0109ce8d..7486dced9 100644 --- a/source/threading/CMakeLists.txt +++ b/source/threading/CMakeLists.txt @@ -178,7 +178,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC diff --git a/source/version/CMakeLists.txt b/source/version/CMakeLists.txt index d62729c68..235dd1e3a 100644 --- a/source/version/CMakeLists.txt +++ b/source/version/CMakeLists.txt @@ -151,7 +151,7 @@ target_compile_options(${target} # Linker options # -target_link_libraries(${target} +add_link_options(${target} PRIVATE PUBLIC From ab80538e77ac7d69f684160bb1b01b5c69285376 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Mon, 3 Feb 2025 22:38:15 +0100 Subject: [PATCH 20/66] Add base for supporting weak symbols on node loader. --- source/loaders/node_loader/CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index d4af40596..5324ea73c 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -157,9 +157,6 @@ target_link_libraries(${target} PRIVATE ${META_PROJECT_NAME}::metacall # MetaCall library - # TODO: Implement workaround to the problem: "PE32 file format does not support weak linkage" - # $<$:${NodeJS_LIBRARY}> # NodeJS library - PUBLIC ${DEFAULT_LIBRARIES} @@ -200,8 +197,10 @@ target_compile_options(${target} add_link_options(${target} PRIVATE - # TODO: MacOS - # $<$:-Wl,-undefined=dynamic_lookup> + $<$:/IGNORE:4199> + $<$:/DELAYLOAD:${NodeJS_LIBRARY_NAME}> + $<$:/DELAYLOAD:${NodeJS_LIBRARY_NAME}> + $<$,$>:-undefined dynamic_lookup> PUBLIC ${DEFAULT_LINKER_OPTIONS} From cd1cb340510da17e568f893d7bfdbecf211d1d2b Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Mon, 3 Feb 2025 23:17:41 +0100 Subject: [PATCH 21/66] Solve issue of NodeJS with MSVC. --- source/loaders/node_loader/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index 5324ea73c..f1803877a 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -157,6 +157,8 @@ target_link_libraries(${target} PRIVATE ${META_PROJECT_NAME}::metacall # MetaCall library + $<$:${NodeJS_LIBRARY}> # NodeJS library + PUBLIC ${DEFAULT_LIBRARIES} @@ -197,9 +199,6 @@ target_compile_options(${target} add_link_options(${target} PRIVATE - $<$:/IGNORE:4199> - $<$:/DELAYLOAD:${NodeJS_LIBRARY_NAME}> - $<$:/DELAYLOAD:${NodeJS_LIBRARY_NAME}> $<$,$>:-undefined dynamic_lookup> PUBLIC From a6c0144d8b16e6190948859502356c9b218424f3 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 5 Feb 2025 06:15:55 +0100 Subject: [PATCH 22/66] Add thread safety for metacall link. --- source/detour/source/detour.c | 5 ++++ source/metacall/source/metacall_link.c | 30 ++++++++++++++++--- .../threading/threading_atomic_ref_count.h | 2 +- .../include/threading/threading_mutex.h | 16 +++++----- .../threading/source/threading_mutex_macos.c | 8 ++--- .../source/threading_mutex_pthread.c | 10 +++---- .../threading/source/threading_mutex_win32.c | 12 ++++---- 7 files changed, 54 insertions(+), 29 deletions(-) diff --git a/source/detour/source/detour.c b/source/detour/source/detour.c index 3eeb57d6d..5503f4494 100644 --- a/source/detour/source/detour.c +++ b/source/detour/source/detour.c @@ -67,6 +67,11 @@ const char *detour_name(detour d) void (*detour_trampoline(detour_handle handle))(void) { + if (handle == NULL) + { + return NULL; + } + return handle->target; } diff --git a/source/metacall/source/metacall_link.c b/source/metacall/source/metacall_link.c index 9bad2939a..1124c9d2d 100644 --- a/source/metacall/source/metacall_link.c +++ b/source/metacall/source/metacall_link.c @@ -25,6 +25,8 @@ #include +#include + #include #include @@ -36,8 +38,8 @@ /* -- Private Variables -- */ static detour_handle detour_link_handle = NULL; - static set metacall_link_table = NULL; +static threading_mutex_type link_mutex = THREADING_MUTEX_INITIALIZE; #if defined(WIN32) || defined(_WIN32) || \ defined(__CYGWIN__) || defined(__CYGWIN32__) || \ @@ -54,10 +56,18 @@ FARPROC metacall_link_hook(HMODULE handle, LPCSTR symbol) { typedef FARPROC (*metacall_link_func_ptr)(HMODULE, LPCSTR); - metacall_link_func_ptr metacall_link_trampoline = (metacall_link_func_ptr)detour_trampoline(detour_link_handle); + metacall_link_func_ptr metacall_link_trampoline; + + void *ptr; + + threading_mutex_lock(&link_mutex); + + metacall_link_trampoline = (metacall_link_func_ptr)detour_trampoline(detour_link_handle); /* Intercept if any */ - void *ptr = set_get(metacall_link_table, (set_key)symbol); + ptr = set_get(metacall_link_table, (set_key)symbol); + + threading_mutex_unlock(&link_mutex); if (ptr != NULL) { @@ -87,7 +97,11 @@ void *metacall_link_hook(void *handle, const char *symbol) { typedef void *(*metacall_link_func_ptr)(void *, const char *); - metacall_link_func_ptr metacall_link_trampoline = (metacall_link_func_ptr)detour_trampoline(detour_link_handle); + metacall_link_func_ptr metacall_link_trampoline; + + threading_mutex_lock(&link_mutex); + + metacall_link_trampoline = (metacall_link_func_ptr)detour_trampoline(detour_link_handle); /* Intercept function if any */ void *ptr = set_get(metacall_link_table, (set_key)symbol); @@ -95,6 +109,8 @@ void *metacall_link_hook(void *handle, const char *symbol) /* TODO: Disable logs here until log is completely thread safe and async signal safe */ /* log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall detour link interception: %s -> %p", symbol, ptr); */ + threading_mutex_unlock(&link_mutex); + if (ptr != NULL) { return ptr; @@ -172,6 +188,8 @@ int metacall_link_destroy(void) { int result = 0; + threading_mutex_lock(&link_mutex); + if (detour_link_handle != NULL) { detour d = detour_create(metacall_detour()); @@ -193,5 +211,9 @@ int metacall_link_destroy(void) metacall_link_table = NULL; } + threading_mutex_unlock(&link_mutex); + + threading_mutex_destroy(&link_mutex); + return result; } diff --git a/source/threading/include/threading/threading_atomic_ref_count.h b/source/threading/include/threading/threading_atomic_ref_count.h index afdae715b..9e152bb0a 100644 --- a/source/threading/include/threading/threading_atomic_ref_count.h +++ b/source/threading/include/threading/threading_atomic_ref_count.h @@ -50,7 +50,7 @@ struct threading_atomic_ref_count_type { #if defined(__THREAD_SANITIZER__) uintmax_t count; - struct threading_mutex_type m; + threading_mutex_type m; #else atomic_uintmax_t count; #endif diff --git a/source/threading/include/threading/threading_mutex.h b/source/threading/include/threading/threading_mutex.h index 174e5772e..b8762b25c 100644 --- a/source/threading/include/threading/threading_mutex.h +++ b/source/threading/include/threading/threading_mutex.h @@ -33,6 +33,10 @@ extern "C" { #if defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) #include + #define THREADING_MUTEX_INITIALIZE \ + { \ + 0 \ + } typedef CRITICAL_SECTION threading_mutex_impl_type; #elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux) || defined(__gnu_linux__) || defined(__TOS_LINUX__)) || \ defined(__FreeBSD__) || \ @@ -41,10 +45,12 @@ typedef CRITICAL_SECTION threading_mutex_impl_type; (defined(bsdi) || defined(__bsdi__)) || \ defined(__DragonFly__) #include + #define THREADING_MUTEX_INITIALIZE PTHREAD_MUTEX_INITIALIZER typedef pthread_mutex_t threading_mutex_impl_type; #elif (defined(__MACOS__) || defined(macintosh) || defined(Macintosh) || defined(__TOS_MACOS__)) || \ (defined(__APPLE__) && defined(__MACH__)) || defined(__MACOSX__) #include + #define THREADING_MUTEX_INITIALIZE OS_UNFAIR_LOCK_INIT typedef os_unfair_lock threading_mutex_impl_type; #else #error "Platform not supported for mutex implementation" @@ -52,16 +58,10 @@ typedef os_unfair_lock threading_mutex_impl_type; #include -/* -- Member Data -- */ - -struct threading_mutex_type -{ - threading_mutex_impl_type impl; -}; - /* -- Type Definitions -- */ -typedef struct threading_mutex_type *threading_mutex; +typedef threading_mutex_impl_type threading_mutex_type; +typedef threading_mutex_type *threading_mutex; /* -- Methods -- */ diff --git a/source/threading/source/threading_mutex_macos.c b/source/threading/source/threading_mutex_macos.c index e8fe44047..dbcdd2218 100644 --- a/source/threading/source/threading_mutex_macos.c +++ b/source/threading/source/threading_mutex_macos.c @@ -26,21 +26,21 @@ int threading_mutex_initialize(threading_mutex m) { - memset(&m->impl, 0, sizeof(os_unfair_lock)); + memset(m, 0, sizeof(os_unfair_lock)); return 0; } int threading_mutex_lock(threading_mutex m) { - os_unfair_lock_lock(&m->impl); + os_unfair_lock_lock(m); return 0; } int threading_mutex_try_lock(threading_mutex m) { - if (os_unfair_lock_trylock(&m->impl) == false) + if (os_unfair_lock_trylock(m) == false) { return 1; } @@ -50,7 +50,7 @@ int threading_mutex_try_lock(threading_mutex m) int threading_mutex_unlock(threading_mutex m) { - os_unfair_lock_unlock(&m->impl); + os_unfair_lock_unlock(m); return 0; } diff --git a/source/threading/source/threading_mutex_pthread.c b/source/threading/source/threading_mutex_pthread.c index 3a288830e..3536387eb 100644 --- a/source/threading/source/threading_mutex_pthread.c +++ b/source/threading/source/threading_mutex_pthread.c @@ -24,25 +24,25 @@ int threading_mutex_initialize(threading_mutex m) { - return pthread_mutex_init(&m->impl, NULL); + return pthread_mutex_init(m, NULL); } int threading_mutex_lock(threading_mutex m) { - return pthread_mutex_lock(&m->impl); + return pthread_mutex_lock(m); } int threading_mutex_try_lock(threading_mutex m) { - return pthread_mutex_trylock(&m->impl); + return pthread_mutex_trylock(m); } int threading_mutex_unlock(threading_mutex m) { - return pthread_mutex_unlock(&m->impl); + return pthread_mutex_unlock(m); } int threading_mutex_destroy(threading_mutex m) { - return pthread_mutex_destroy(&m->impl); + return pthread_mutex_destroy(m); } diff --git a/source/threading/source/threading_mutex_win32.c b/source/threading/source/threading_mutex_win32.c index 16739c50d..19cdef9fe 100644 --- a/source/threading/source/threading_mutex_win32.c +++ b/source/threading/source/threading_mutex_win32.c @@ -22,25 +22,23 @@ #include -#include - int threading_mutex_initialize(threading_mutex m) { - InitializeCriticalSection(&m->impl); + InitializeCriticalSection(m); return 0; } int threading_mutex_lock(threading_mutex m) { - EnterCriticalSection(&m->impl); + EnterCriticalSection(m); return 0; } int threading_mutex_try_lock(threading_mutex m) { - if (TryEnterCriticalSection(&m->impl) == 0) + if (TryEnterCriticalSection(m) == 0) { return 1; } @@ -50,14 +48,14 @@ int threading_mutex_try_lock(threading_mutex m) int threading_mutex_unlock(threading_mutex m) { - LeaveCriticalSection(&m->impl); + LeaveCriticalSection(m); return 0; } int threading_mutex_destroy(threading_mutex m) { - DeleteCriticalSection(&m->impl); + DeleteCriticalSection(m); return 0; } From 64a6150f48a00975420a3a37a7724d65db8f5a23 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 5 Feb 2025 06:16:24 +0100 Subject: [PATCH 23/66] Add proper link flags for node_loader on macos. --- source/loaders/node_loader/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index f1803877a..d372ccdb0 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -199,7 +199,7 @@ target_compile_options(${target} add_link_options(${target} PRIVATE - $<$,$>:-undefined dynamic_lookup> + $<$,$>:-Wl,-undefined,dynamic_lookup> PUBLIC ${DEFAULT_LINKER_OPTIONS} From f6789193db2945857e15b942aa44fbde34959d1a Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 12 Feb 2025 23:22:29 +0100 Subject: [PATCH 24/66] Add basic atexit support in portability. --- source/log/CMakeLists.txt | 1 + source/log/source/log_singleton.c | 4 +- source/metacall/CMakeLists.txt | 4 +- source/metacall/source/metacall.c | 8 +- source/metacall/source/metacall_link.c | 11 +- source/portability/CMakeLists.txt | 2 + .../include/portability/portability_atexit.h | 63 ++++++++ .../portability/source/portability_atexit.c | 139 ++++++++++++++++++ 8 files changed, 226 insertions(+), 6 deletions(-) create mode 100644 source/portability/include/portability/portability_atexit.h create mode 100644 source/portability/source/portability_atexit.c diff --git a/source/log/CMakeLists.txt b/source/log/CMakeLists.txt index 79c9c9ff9..556c17aae 100644 --- a/source/log/CMakeLists.txt +++ b/source/log/CMakeLists.txt @@ -180,6 +180,7 @@ target_link_libraries(${target} ${META_PROJECT_NAME}::preprocessor ${META_PROJECT_NAME}::format ${META_PROJECT_NAME}::threading + ${META_PROJECT_NAME}::portability PUBLIC ${DEFAULT_LIBRARIES} diff --git a/source/log/source/log_singleton.c b/source/log/source/log_singleton.c index 39d326e64..4b7863d8a 100644 --- a/source/log/source/log_singleton.c +++ b/source/log/source/log_singleton.c @@ -9,6 +9,8 @@ #include #include +#include + #include /* -- Definitions -- */ @@ -98,7 +100,7 @@ log_singleton log_singleton_instance_impl(void) abort(); } - if (atexit(&log_atexit_callback) != 0) + if (portability_atexit_register(&log_atexit_callback) != 0) { if (log_singleton_destroy() != 0) { diff --git a/source/metacall/CMakeLists.txt b/source/metacall/CMakeLists.txt index e04b167e8..ec669d7f0 100644 --- a/source/metacall/CMakeLists.txt +++ b/source/metacall/CMakeLists.txt @@ -200,6 +200,8 @@ target_link_libraries(${target} PUBLIC ${DEFAULT_LIBRARIES} + $<$:${CMAKE_DL_LIBS}> # Native dynamic load library + INTERFACE ) @@ -248,8 +250,6 @@ add_link_options(${target} PUBLIC ${DEFAULT_LINKER_OPTIONS} - $<$:${CMAKE_DL_LIBS}> # Native dynamic load library - INTERFACE ) diff --git a/source/metacall/source/metacall.c b/source/metacall/source/metacall.c index 3fcc54b8c..2fdc314b5 100644 --- a/source/metacall/source/metacall.c +++ b/source/metacall/source/metacall.c @@ -37,6 +37,7 @@ #include +#include #include #include @@ -82,6 +83,9 @@ portability_constructor(metacall_constructor) { const char *metacall_host = environment_variable_get("METACALL_HOST", NULL); + /* Initialize at exit handlers */ + portability_atexit_initialize(); + /* We are running from a different host, initialize the loader of the host * and redirect it to the existing symbols, also avoiding initialization * and destruction of the runtime as it is being managed externally to MetaCall */ @@ -113,7 +117,7 @@ portability_constructor(metacall_constructor) } /* Register the destructor on exit */ - atexit(metacall_destroy); + portability_atexit_register(metacall_destroy); } } } @@ -277,7 +281,7 @@ int metacall_initialize(void) #endif /* METACALL_FORK_SAFE */ /* Define destructor for detouring (it must be executed at the end to prevent problems with fork mechanisms) */ - atexit(metacall_detour_destructor); + portability_atexit_register(metacall_detour_destructor); } /* Initialize configuration and serializer */ diff --git a/source/metacall/source/metacall_link.c b/source/metacall/source/metacall_link.c index 1124c9d2d..946d37a39 100644 --- a/source/metacall/source/metacall_link.c +++ b/source/metacall/source/metacall_link.c @@ -99,12 +99,14 @@ void *metacall_link_hook(void *handle, const char *symbol) metacall_link_func_ptr metacall_link_trampoline; + void *ptr; + threading_mutex_lock(&link_mutex); metacall_link_trampoline = (metacall_link_func_ptr)detour_trampoline(detour_link_handle); /* Intercept function if any */ - void *ptr = set_get(metacall_link_table, (set_key)symbol); + ptr = set_get(metacall_link_table, (set_key)symbol); /* TODO: Disable logs here until log is completely thread safe and async signal safe */ /* log_write("metacall", LOG_LEVEL_DEBUG, "MetaCall detour link interception: %s -> %p", symbol, ptr); */ @@ -129,6 +131,13 @@ int metacall_link_initialize(void) { detour d = detour_create(metacall_detour()); + if (threading_mutex_initialize(&link_mutex) != 0) + { + log_write("metacall", LOG_LEVEL_ERROR, "MetaCall invalid link mutex initialization"); + + return 1; + } + if (detour_link_handle == NULL) { detour_link_handle = detour_install(d, (void (*)(void))metacall_link_func(), (void (*)(void))(&metacall_link_hook)); diff --git a/source/portability/CMakeLists.txt b/source/portability/CMakeLists.txt index fab62a921..65b9dd1f2 100644 --- a/source/portability/CMakeLists.txt +++ b/source/portability/CMakeLists.txt @@ -40,6 +40,7 @@ set(headers ${include_path}/portability_library_path.h ${include_path}/portability_working_path.h ${include_path}/portability_path.h + ${include_path}/portability_atexit.h ) set(sources @@ -48,6 +49,7 @@ set(sources ${source_path}/portability_library_path.c ${source_path}/portability_working_path.c ${source_path}/portability_path.c + ${source_path}/portability_atexit.c ) # Group source files diff --git a/source/portability/include/portability/portability_atexit.h b/source/portability/include/portability/portability_atexit.h new file mode 100644 index 000000000..78c107b1a --- /dev/null +++ b/source/portability/include/portability/portability_atexit.h @@ -0,0 +1,63 @@ +/* + * Portability Library by Parra Studios + * A generic cross-platform portability utility. + * + * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef PORTABILITY_ATEXIT_H +#define PORTABILITY_ATEXIT_H 1 + +/* -- Headers -- */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* -- Type Definitions -- */ + +typedef void (*portability_atexit_fn)(void); + +/* -- Methods -- */ + +/** +* @brief +* Initialize atexit instance for custom at exit handlers +* +* @return +* Zero if success, different from zero otherwise +*/ +PORTABILITY_API int portability_atexit_initialize(void); + +/** +* @brief +* Register handler to be run at exit +* +* @param[in] handler +* Function pointer to the handler that will be executed at exit +* +* @return +* Zero if success, different from zero otherwise +*/ +PORTABILITY_API int portability_atexit_register(portability_atexit_fn handler); + +#ifdef __cplusplus +} +#endif + +#endif /* PORTABILITY_ATEXIT_H */ diff --git a/source/portability/source/portability_atexit.c b/source/portability/source/portability_atexit.c new file mode 100644 index 000000000..d08ee3653 --- /dev/null +++ b/source/portability/source/portability_atexit.c @@ -0,0 +1,139 @@ +/* + * MetaCall Library by Parra Studios + * A library for providing a foreign function interface calls. + * + * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/* -- Headers -- */ + +#include + +#include + +/* -- Member Data -- */ + +struct atexit_node_type +{ + portability_atexit_fn handler; + struct atexit_node_type *next; +}; + +/* -- Private Variables -- */ + +static struct atexit_node_type *atexit_list = NULL; + +/* -- Private Methods -- */ + +static void portability_atexit_destroy(void) +{ + if (atexit_list != NULL) + { + do + { + struct atexit_node_type *prev = atexit_list; + + atexit_list = prev->next; + + if (prev->handler != NULL) + { + prev->handler(); + } + + free(prev); + } while (atexit_list != NULL); + + atexit_list = NULL; + } +} + +/* -- Methods -- */ + +int portability_atexit_initialize(void) +{ + static int atexit_registered = 0; + + if (atexit_list == NULL) + { + atexit_list = malloc(sizeof(struct atexit_node_type)); + + if (atexit_list == NULL) + { + return 1; + } + + atexit_list->handler = NULL; + atexit_list->next = NULL; + } + + if (atexit_registered == 0) + { + atexit(&portability_atexit_destroy); + atexit_registered = 1; + } + + return 0; +} + +int portability_atexit_register(portability_atexit_fn handler) +{ + if (atexit_list == NULL) + { + return 1; + } + + if (atexit_list->handler == NULL) + { + atexit_list->handler = handler; + } + else + { + struct atexit_node_type *iterator = atexit_list; + + /* Find the last or duplicates */ + for (;;) + { + if (iterator->handler == handler) + { + /* Already registered, skip */ + return 1; + } + + if (iterator->next == NULL) + { + break; + } + + iterator = iterator->next; + } + + /* Allocate the new node */ + struct atexit_node_type *node = malloc(sizeof(struct atexit_node_type)); + + if (node == NULL) + { + return 1; + } + + node->handler = handler; + node->next = atexit_list; + + /* Insert it at the begining */ + atexit_list = node; + } + + return 0; +} From 9ba88287f5b33f3205e0c92b99c904d8842fa1b4 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 13 Feb 2025 00:37:25 +0200 Subject: [PATCH 25/66] Revert "Bump store2 in /source/scripts/node/gram/source/gram (#541)" This reverts commit ce9b9e66eb4840e184ace22c309f1dca35659c88. --- .../scripts/node/gram/source/gram/package-lock.json | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/source/scripts/node/gram/source/gram/package-lock.json b/source/scripts/node/gram/source/gram/package-lock.json index 1f9839313..27be43c05 100644 --- a/source/scripts/node/gram/source/gram/package-lock.json +++ b/source/scripts/node/gram/source/gram/package-lock.json @@ -310,10 +310,9 @@ } }, "node_modules/store2": { - "version": "2.14.4", - "resolved": "https://registry.npmjs.org/store2/-/store2-2.14.4.tgz", - "integrity": "sha512-srTItn1GOvyvOycgxjAnPA63FZNwy0PTyUBFMHRM+hVFltAeoh0LmNBz9SZqUS9mMqGk8rfyWyXn3GH5ReJ8Zw==", - "license": "MIT" + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/store2/-/store2-2.12.0.tgz", + "integrity": "sha512-7t+/wpKLanLzSnQPX8WAcuLCCeuSHoWdQuh9SB3xD0kNOM38DNf+0Oa+wmvxmYueRzkmh6IcdKFtvTa+ecgPDw==" }, "node_modules/telegram": { "version": "1.7.19", @@ -670,9 +669,9 @@ "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=" }, "store2": { - "version": "2.14.4", - "resolved": "https://registry.npmjs.org/store2/-/store2-2.14.4.tgz", - "integrity": "sha512-srTItn1GOvyvOycgxjAnPA63FZNwy0PTyUBFMHRM+hVFltAeoh0LmNBz9SZqUS9mMqGk8rfyWyXn3GH5ReJ8Zw==" + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/store2/-/store2-2.12.0.tgz", + "integrity": "sha512-7t+/wpKLanLzSnQPX8WAcuLCCeuSHoWdQuh9SB3xD0kNOM38DNf+0Oa+wmvxmYueRzkmh6IcdKFtvTa+ecgPDw==" }, "telegram": { "version": "1.7.19", From 037296f7a901e0949fe438ff371a86c5b161d52a Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 12 Feb 2025 23:54:02 +0100 Subject: [PATCH 26/66] Add init of atexit in logs. --- source/log/source/log_singleton.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/log/source/log_singleton.c b/source/log/source/log_singleton.c index 4b7863d8a..cd6aefa40 100644 --- a/source/log/source/log_singleton.c +++ b/source/log/source/log_singleton.c @@ -100,6 +100,9 @@ log_singleton log_singleton_instance_impl(void) abort(); } + /* Initialize at exit handlers */ + portability_atexit_initialize(); + if (portability_atexit_register(&log_atexit_callback) != 0) { if (log_singleton_destroy() != 0) From fc940c78d0b8446498def1c16047f4037904825c Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 13 Feb 2025 17:20:33 +0100 Subject: [PATCH 27/66] Solve issue with windows lib names. --- source/loaders/node_loader/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index d372ccdb0..4dd360fe0 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -240,6 +240,7 @@ if(NodeJS_LIBRARY_NAME_PATH AND WIN32) ) get_filename_component(NodeJS_LIBRARY_NAME "${NodeJS_LIBRARY_NAME_PATH}" NAME) + set(NodeJS_LIBRARY_DEVELOPMENT "${NodeJS_LIBRARY_NAME_PATH}") set(NodeJS_LIBRARY_INSTALL "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB}/${NodeJS_LIBRARY_NAME}") elseif(NodeJS_BUILD_FROM_SOURCE AND NOT WIN32) install(FILES From d4fbdb211c8adc0c0a3f9da04e97607836cd125f Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 21 Feb 2025 00:58:50 +0100 Subject: [PATCH 28/66] Improve node port types. --- source/ports/node_port/index.d.ts | 40 +++++++++++++++++++------------ 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/source/ports/node_port/index.d.ts b/source/ports/node_port/index.d.ts index 3be9a4809..e9fe6b2a2 100644 --- a/source/ports/node_port/index.d.ts +++ b/source/ports/node_port/index.d.ts @@ -1,16 +1,26 @@ -declare module 'metacall' { - export function metacall(name: string, ...args: any): any; - export function metacallfms(name: string, buffer: string): any; - export function metacall_execution_path(tag: string, path: string): number; - export function metacall_load_from_file(tag: string, paths: string[]): number; - export function metacall_load_from_file_export(tag: string, paths: string[]): any; - export function metacall_load_from_memory(tag: string, code: string): number; - export function metacall_load_from_memory_export(tag: string, code: string): any; - export function metacall_load_from_package(tag: string, pkg: string): number; - export function metacall_load_from_package_export(tag: string, pkg: string): any; - export function metacall_load_from_configuration(path: string): number; - export function metacall_load_from_configuration_export(path: string): any; - export function metacall_inspect(): any; - export function metacall_handle(tag: string, name: string): any; - export function metacall_logs(): void; +declare module "metacall" { + export function metacall(name: string, ...args: any): any; + export function metacallfms(name: string, buffer: string): any; + export function metacall_await(name: string, ...args: any): any; + export function metacall_execution_path(tag: string, path: string): number; + export function metacall_load_from_file(tag: string, paths: string[]): number; + export function metacall_load_from_file_export( + tag: string, + paths: string[] + ): any; + export function metacall_load_from_memory(tag: string, code: string): number; + export function metacall_load_from_memory_export( + tag: string, + code: string + ): any; + export function metacall_load_from_package(tag: string, pkg: string): number; + export function metacall_load_from_package_export( + tag: string, + pkg: string + ): any; + export function metacall_load_from_configuration(path: string): number; + export function metacall_load_from_configuration_export(path: string): any; + export function metacall_inspect(): any; // TODO: Implement return type + export function metacall_handle(tag: string, name: string): any; + export function metacall_logs(): void; } From 7587d8ace357e510422e77d07f865f5c3f796d23 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Fri, 21 Feb 2025 00:59:33 +0100 Subject: [PATCH 29/66] Solve issues with funchook and rapid_json. --- cmake/InstallRapidJSON.cmake | 18 ++++++------- source/detours/CMakeLists.txt | 2 +- source/detours/funchook_detour/CMakeLists.txt | 25 +++++++------------ .../funchook_detour/scripts/download.bat.in | 12 --------- .../funchook_detour/scripts/download.sh.in | 9 ------- source/tests/detour_test/CMakeLists.txt | 2 +- .../tests/metacall_fork_test/CMakeLists.txt | 2 +- 7 files changed, 20 insertions(+), 50 deletions(-) delete mode 100755 source/detours/funchook_detour/scripts/download.bat.in delete mode 100755 source/detours/funchook_detour/scripts/download.sh.in diff --git a/cmake/InstallRapidJSON.cmake b/cmake/InstallRapidJSON.cmake index 8b4bc960d..44938fceb 100644 --- a/cmake/InstallRapidJSON.cmake +++ b/cmake/InstallRapidJSON.cmake @@ -28,19 +28,17 @@ if(NOT RAPIDJSON_FOUND OR USE_BUNDLED_RAPIDJSON) endif() ExternalProject_Add(rapid-json-depends - GIT_REPOSITORY "https://github.com/Tencent/rapidjson.git" - GIT_TAG "${RAPIDJSON_VERSION}" - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX= - -DRAPIDJSON_BUILD_DOC=Off - -DRAPIDJSON_BUILD_EXAMPLES=Off - -DRAPIDJSON_BUILD_TESTS=Off - TEST_COMMAND "" + GIT_REPOSITORY "https://github.com/Tencent/rapidjson.git" + GIT_TAG "${RAPIDJSON_VERSION}" + BUILD_COMMAND "" + CONFIGURE_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" ) - ExternalProject_Get_Property(rapid-json-depends INSTALL_DIR) + ExternalProject_Get_Property(rapid-json-depends SOURCE_DIR) - set(RAPIDJSON_ROOT_DIR ${INSTALL_DIR}) + set(RAPIDJSON_ROOT_DIR ${SOURCE_DIR}) set(RAPIDJSON_INCLUDE_DIRS ${RAPIDJSON_ROOT_DIR}/include) set(RAPIDJSON_FOUND TRUE) diff --git a/source/detours/CMakeLists.txt b/source/detours/CMakeLists.txt index 366f9f42c..c1f851b97 100644 --- a/source/detours/CMakeLists.txt +++ b/source/detours/CMakeLists.txt @@ -1,5 +1,5 @@ # Check if detours are enabled -if(NOT OPTION_FORK_SAFE OR NOT OPTION_BUILD_DETOURS) +if(NOT OPTION_BUILD_DETOURS) return() endif() diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index a822ca631..74c39ef67 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -1,5 +1,5 @@ # Check if this detour is enabled -if(NOT OPTION_FORK_SAFE OR NOT OPTION_BUILD_DETOURS OR NOT OPTION_BUILD_DETOURS_FUNCHOOK) +if(NOT OPTION_BUILD_DETOURS OR NOT OPTION_BUILD_DETOURS_FUNCHOOK) return() endif() @@ -17,43 +17,36 @@ include(ExternalProject) set(FUNCHOOK_VERSION 1.1.3) if(WIN32) - set(FUNCHOOK_LIBRARY_PREFIX "") set(FUNCHOOK_LIBRARY_SUFFIX "lib") set(FUNCHOOK_LIBRARY_INSTALL_SUFFIX "dll") elseif(APPLE) - set(FUNCHOOK_LIBRARY_PREFIX "lib") set(FUNCHOOK_LIBRARY_SUFFIX "dylib") - set(FUNCHOOK_LIBRARY_INSTALL_SUFFIX "dylib") else() - set(FUNCHOOK_LIBRARY_PREFIX "lib") set(FUNCHOOK_LIBRARY_SUFFIX "so") - set(FUNCHOOK_LIBRARY_INSTALL_SUFFIX "so") endif() set(FUNCHOOK_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/funchook/src/funchook") if(WIN32) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/download.bat.in ${CMAKE_CURRENT_BINARY_DIR}/download.bat @ONLY) - set(FUNCHOOK_DOWNLOAD_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/download.bat) set(FUNCHOOK_BUILD_TARGET "INSTALL") + set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/funchook_dll.${FUNCHOOK_LIBRARY_SUFFIX}") + set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/funchook.${FUNCHOOK_LIBRARY_INSTALL_SUFFIX}") else() - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/download.sh.in ${CMAKE_CURRENT_BINARY_DIR}/download.sh @ONLY) - set(FUNCHOOK_DOWNLOAD_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/download.sh) set(FUNCHOOK_BUILD_TARGET "install") + set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/libfunchook.${FUNCHOOK_LIBRARY_SUFFIX}") + set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_LIBRARY_DIR}") endif() set(FUNCHOOK_INSTALL_DIR "${PROJECT_OUTPUT_DIR}") +set(FUNCHOOK_CMAKE_INSTALL_BINDIR "${PROJECT_OUTPUT_DIR}") set(FUNCHOOK_INCLUDE_DIR "${FUNCHOOK_SOURCE_DIR}/include") -set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/${FUNCHOOK_LIBRARY_PREFIX}funchook.${FUNCHOOK_LIBRARY_SUFFIX}") -set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_SOURCE_DIR}/${FUNCHOOK_LIBRARY_PREFIX}funchook.${FUNCHOOK_LIBRARY_INSTALL_SUFFIX}") -ExternalProject_Add( - ${target_depends} +ExternalProject_Add(${target_depends} PREFIX funchook SOURCE_DIR ${FUNCHOOK_SOURCE_DIR} INSTALL_DIR ${FUNCHOOK_INSTALL_DIR} - DOWNLOAD_COMMAND ${FUNCHOOK_DOWNLOAD_COMMAND} - CONFIGURE_COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_PARALLEL_LEVEL=1 -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON -DCMAKE_INSTALL_PREFIX=${FUNCHOOK_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DFUNCHOOK_BUILD_SHARED=ON -DFUNCHOOK_BUILD_TESTS=OFF -DFUNCHOOK_BUILD_STATIC=OFF . + DOWNLOAD_COMMAND "${GIT_EXECUTABLE}" clone --single-branch --branch v${FUNCHOOK_VERSION} --recursive https://github.com/kubo/funchook.git "${FUNCHOOK_SOURCE_DIR}" + CONFIGURE_COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_PARALLEL_LEVEL=1 -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON -DCMAKE_INSTALL_PREFIX=${FUNCHOOK_INSTALL_DIR} -DCMAKE_INSTALL_BINDIR=${FUNCHOOK_CMAKE_INSTALL_BINDIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DFUNCHOOK_BUILD_SHARED=ON -DFUNCHOOK_BUILD_TESTS=OFF -DFUNCHOOK_BUILD_STATIC=OFF . BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --target ${FUNCHOOK_BUILD_TARGET} UPDATE_COMMAND "" BUILD_IN_SOURCE ON diff --git a/source/detours/funchook_detour/scripts/download.bat.in b/source/detours/funchook_detour/scripts/download.bat.in deleted file mode 100755 index a2702001b..000000000 --- a/source/detours/funchook_detour/scripts/download.bat.in +++ /dev/null @@ -1,12 +0,0 @@ -@echo on - -rem Download repository if it does not exist -if not exist "@FUNCHOOK_SOURCE_DIR@/.git" ( - if exist "@FUNCHOOK_SOURCE_DIR@" ( - rmdir /S /Q "@FUNCHOOK_SOURCE_DIR@" - ) - "@GIT_EXECUTABLE@" clone --single-branch --branch v@FUNCHOOK_VERSION@ --recursive https://github.com/kubo/funchook.git "@FUNCHOOK_SOURCE_DIR@" -) - -rem Write empty CMake file to avoid cmake warnings -copy /y nul "@FUNCHOOK_SOURCE_DIR@/CMakeLists.txt" diff --git a/source/detours/funchook_detour/scripts/download.sh.in b/source/detours/funchook_detour/scripts/download.sh.in deleted file mode 100755 index 122a268bf..000000000 --- a/source/detours/funchook_detour/scripts/download.sh.in +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env sh - -# Download repository if it does not exist -if [ ! -d "@FUNCHOOK_SOURCE_DIR@/.git" ]; then - if [ -d "@FUNCHOOK_SOURCE_DIR@" ]; then - rm -rf "@FUNCHOOK_SOURCE_DIR@" - fi - "@GIT_EXECUTABLE@" clone --single-branch --branch v@FUNCHOOK_VERSION@ --recursive https://github.com/kubo/funchook.git "@FUNCHOOK_SOURCE_DIR@" -fi diff --git a/source/tests/detour_test/CMakeLists.txt b/source/tests/detour_test/CMakeLists.txt index 1e96fa5a0..b84f0f4a5 100644 --- a/source/tests/detour_test/CMakeLists.txt +++ b/source/tests/detour_test/CMakeLists.txt @@ -1,5 +1,5 @@ # Check if detours are enabled -if(NOT OPTION_FORK_SAFE OR NOT OPTION_BUILD_DETOURS OR NOT OPTION_BUILD_DETOURS_FUNCHOOK) +if(NOT OPTION_BUILD_DETOURS OR NOT OPTION_BUILD_DETOURS_FUNCHOOK) return() endif() diff --git a/source/tests/metacall_fork_test/CMakeLists.txt b/source/tests/metacall_fork_test/CMakeLists.txt index d7f19ff1e..0c526d744 100644 --- a/source/tests/metacall_fork_test/CMakeLists.txt +++ b/source/tests/metacall_fork_test/CMakeLists.txt @@ -1,5 +1,5 @@ # Check if detours are enabled -if(NOT OPTION_BUILD_DETOURS OR NOT OPTION_FORK_SAFE) +if(NOT OPTION_FORK_SAFE OR NOT OPTION_BUILD_DETOURS) return() endif() From 12c3077e09b62d6d86817310b7a3a8f9ec9e3a0f Mon Sep 17 00:00:00 2001 From: Yasindu Dissanayake Date: Fri, 21 Feb 2025 13:11:28 +0530 Subject: [PATCH 30/66] Add Workflow for Multi-Architecture Docker Image Build, Push, and Manifest Management (#535) * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Update docker-hub-platform.yml * Fix issue in tag --------- Co-authored-by: Yasindu Dissanayake Co-authored-by: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> --- .github/workflows/docker-hub-platform.yml | 181 +++++++++++----------- 1 file changed, 89 insertions(+), 92 deletions(-) diff --git a/.github/workflows/docker-hub-platform.yml b/.github/workflows/docker-hub-platform.yml index 32f9fe5d2..db4f323f1 100644 --- a/.github/workflows/docker-hub-platform.yml +++ b/.github/workflows/docker-hub-platform.yml @@ -14,7 +14,9 @@ concurrency: cancel-in-progress: true env: - IMAGE_NAME: index.docker.io/metacall/core + DOCKER_REGISTRY: index.docker.io + DOCKER_USERNAME: metacall + IMAGE_NAME: core BUILDKIT_VERSION: 0.13.0 jobs: @@ -26,41 +28,28 @@ jobs: matrix: platform: - linux/amd64 + - linux/386 - linux/arm64 - linux/riscv64 - linux/ppc64le - linux/s390x - - linux/386 - linux/arm/v7 - linux/arm/v6 - # - linux/mips64le - # - linux/mips64 - steps: - - name: Checkout the code + - name: Checkout Repository uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.IMAGE_NAME }} - - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - name: Docker Setup BuildX + - name: Set up Docker BuildX uses: docker/setup-buildx-action@v3 with: version: v${{ env.BUILDKIT_VERSION }} - - name: Verify Docker BuildX Version - run: docker buildx version - - - name: Authenticate to Docker registry - if: github.event_name != 'pull_request' + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} @@ -72,93 +61,101 @@ jobs: run: | ./docker-compose.sh platform - # - name: Generate images - # if: github.event_name != 'pull_request' - # run: | - # for tag in "deps" "dev" "runtime" "cli"; do - # mkdir -p "/tmp/images/${tag}" - # digest="$(docker images --no-trunc --quiet metacall/core:${tag})" - # echo "FROM metacall/core:${tag}@${digest}" &> "/tmp/images/${tag}/Dockerfile" - # done - - # - name: Build and push by digest (deps) - # id: build - # uses: docker/build-push-action@v6 - # if: github.event_name != 'pull_request' - # with: - # context: /tmp/images/deps/Dockerfile - # platforms: ${{ matrix.platform }} - # labels: ${{ steps.meta.outputs.labels }} - # outputs: type=image,name=docker.io/${{ env.IMAGE_NAME }}:deps,push-by-digest=true,name-canonical=true,push=true - - - name: Export digests - if: github.event_name != 'pull_request' + - name: Tag Platform Images run: | - PLATFORM=${{ matrix.platform }} - echo "PLATFORM=${PLATFORM//\//-}" >> $GITHUB_ENV + platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') + echo "Platform Tag: ${platform_tag}" for tag in "deps" "dev" "runtime" "cli"; do - mkdir -p "/tmp/digests/${tag}" - digest="$(docker images --no-trunc --quiet metacall/core:${tag})" - touch "/tmp/digests/${tag}/${digest#sha256:}" + docker tag metacall/${IMAGE_NAME}:${tag} \ + ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag} done - - name: Upload digests - if: github.event_name != 'pull_request' - uses: actions/upload-artifact@v4 - with: - name: digests-${{ env.PLATFORM }} - path: /tmp/digests/* - if-no-files-found: error - retention-days: 1 + - name: Push Platform Images + run: | + platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') + for tag in "deps" "dev" "runtime" "cli"; do + echo "Pushing image for tag: ${tag} with platform: ${platform_tag}" + docker push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag} + done - merge: - name: Merge digests for the manifest + - name: Run Tests + run: | + set -exuo pipefail + platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') + cat < Dockerfile.test + FROM ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform_tag} + RUN echo "console.log('abcde')" > script.js + RUN metacallcli script.js + EOF + + docker build --platform ${{ matrix.platform }} -f Dockerfile.test -t test-image . + docker run --rm --platform=${{ matrix.platform }} test-image + + manifest: + name: Create and Push Manifest Lists + needs: build runs-on: ubuntu-latest - if: github.event_name != 'pull_request' - needs: - - build steps: - - name: Download digests - uses: actions/download-artifact@v4 - with: - path: /tmp/digests - pattern: digests-* - merge-multiple: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - version: v${{ env.BUILDKIT_VERSION }} - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.IMAGE_NAME }} - - - name: Authenticate to Docker registry + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - name: Create manifest list and push - if: github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/') + - name: Create and Push Manifest Lists run: | for tag in "deps" "dev" "runtime" "cli"; do - cd "/tmp/digests/${tag}" - IMAGE_HASHES=$(printf '${{ env.IMAGE_NAME }}:${tag}@sha256:%s ' *) - for image in ${IMAGE_HASHES}; do - docker image tag ${image} ${{ env.IMAGE_NAME }}:${tag} - docker push ${{ env.IMAGE_NAME }}:${tag} + echo "Creating manifest for tag: $tag" + platform_tags="" + for platform in "linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6"; do + platform_tag=$(echo "${platform}" | tr '/' '-') + platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag}" + done + echo "Creating manifest with tags: ${platform_tags}" + docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} ${platform_tags} --amend + docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} + done + + - name: Create Version Specific Tags + if: startsWith(github.ref, 'refs/tags/') + run: | + VERSION=${GITHUB_REF#refs/tags/v} + tags=("deps" "dev" "runtime" "cli") + platforms=("linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6") + for tag in "${tags[@]}"; do + platform_tags="" + for platform in "${platforms[@]}"; do + platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform}" + done + docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} ${platform_tags} --amend + docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} + done + + cli_platform_tags="" + for platform in ${{ matrix.platform }}; do + cli_platform_tags="${cli_platform_tags} ${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform}" + done + docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:latest ${cli_platform_tags} --amend + docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:latest + + cleanup: + name: Cleanup Platform Specific Tags + needs: [build, manifest] + runs-on: ubuntu-latest + if: always() + steps: + - name: Remove Platform-Specific Tags + run: | + platforms=("linux-amd64" "linux-386" "linux-arm64" "linux-riscv64" "linux-ppc64le" "linux-s390x" "linux-arm-v7" "linux-arm-v6") + tags=("deps" "dev" "runtime" "cli") + + for platform in "${platforms[@]}"; do + for tag in "${tags[@]}"; do + tag_to_delete="${tag}-${platform}" + echo "Deleting tag: ${tag_to_delete}" + + curl -X DELETE \ + -H "Authorization: Bearer ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" \ + "https://hub.docker.com/v2/repositories/${DOCKER_USERNAME}/${IMAGE_NAME}/tags/${tag_to_delete}/" done - docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:${tag} ${IMAGE_HASHES} - if [[ "${tag}" = "cli" ]]; then - docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:latest ${IMAGE_HASHES} - if [[ "${{ contains(github.ref, 'refs/tags/') }}" = true ]]; then - TAG=${GITHUB_REF#refs/*/} - VERSION=${TAG#v} - docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:${VERSION} ${IMAGE_HASHES} - fi - fi done From d89b966e93bd4326085499b0d13b6038e932c2a5 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Mon, 24 Feb 2025 23:36:56 +0100 Subject: [PATCH 31/66] Trying to solve issues macos. --- source/loaders/node_loader/CMakeLists.txt | 5 ++++- source/ports/node_port/index.js | 11 +++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index 4dd360fe0..1f88155f1 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -172,6 +172,9 @@ target_link_libraries(${target} target_compile_definitions(${target} PRIVATE $<$:NODEJS_LIBRARY_NAME="${NodeJS_LIBRARY_NAME}"> + $<$>:_LARGEFILE_SOURCE> + $<$>:_FILE_OFFSET_BITS=64> + $<$,$>:_DARWIN_USE_64_BIT_INODE=1> PUBLIC $<$>:${target_upper}_STATIC_DEFINE> @@ -199,7 +202,7 @@ target_compile_options(${target} add_link_options(${target} PRIVATE - $<$,$>:-Wl,-undefined,dynamic_lookup> + $<$,$>:-undefined dynamic_lookup> PUBLIC ${DEFAULT_LINKER_OPTIONS} diff --git a/source/ports/node_port/index.js b/source/ports/node_port/index.js index 296e33e68..44c264ae9 100644 --- a/source/ports/node_port/index.js +++ b/source/ports/node_port/index.js @@ -25,20 +25,15 @@ const path = require('path'); const fs = require('fs'); const { URL } = require('url'); /* TODO: RPC Loader */ -const findFilesRecursively = (dirPattern, filePattern, depthLimit = Infinity) => { - const stack = [{ dir: dirPattern, depth: 0 }]; +const findFilesRecursively = (directory, filePattern, depthLimit = Infinity) => { + const stack = [{ dir: directory, depth: 0 }]; const files = []; - const dirRegex = new RegExp(dirPattern); const fileRegex = new RegExp(filePattern); while (stack.length > 0) { const { dir, depth } = stack.pop(); try { - if (!dirRegex.test(dir)) { - continue; - } - if (depth > depthLimit) { continue; } @@ -56,7 +51,7 @@ const findFilesRecursively = (dirPattern, filePattern, depthLimit = Infinity) => } } } catch (err) { - console.error(`Error reading directory ${dir}:`, err); + console.error(`Error reading directory '${dir}' while searching for MetaCall Library:`, err); } } From d73b40a3d129e783c7980da13ff8dfd8f6557768 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Mon, 24 Feb 2025 23:44:54 +0100 Subject: [PATCH 32/66] Solve issues in platform delete tag. --- .github/workflows/docker-hub-platform.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-hub-platform.yml b/.github/workflows/docker-hub-platform.yml index db4f323f1..d97b7d738 100644 --- a/.github/workflows/docker-hub-platform.yml +++ b/.github/workflows/docker-hub-platform.yml @@ -155,7 +155,7 @@ jobs: echo "Deleting tag: ${tag_to_delete}" curl -X DELETE \ - -H "Authorization: Bearer ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" \ - "https://hub.docker.com/v2/repositories/${DOCKER_USERNAME}/${IMAGE_NAME}/tags/${tag_to_delete}/" + -u "${{ secrets.DOCKER_HUB_USERNAME }}:${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" \ + "https://cloud.docker.com/v2/repositories/${DOCKER_USERNAME}/${IMAGE_NAME}/tags/${tag_to_delete}/" done done From dfeb5595ba3431d9860f6a6017a1c5bca5887d2e Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 01:08:03 +0100 Subject: [PATCH 33/66] Trying to test macos. --- source/loaders/node_loader/CMakeLists.txt | 4 +++- .../node_extension_test/CMakeLists.txt | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index 1f88155f1..1592c141c 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -202,7 +202,9 @@ target_compile_options(${target} add_link_options(${target} PRIVATE - $<$,$>:-undefined dynamic_lookup> + # $<$,$>:-Wl,-undefined,dynamic_lookup> + # $<$,$>:-undefined dynamic_lookup> + -Wl,-undefined,dynamic_lookup PUBLIC ${DEFAULT_LINKER_OPTIONS} diff --git a/source/tests/metacall_node_extension_test/node_extension_test/CMakeLists.txt b/source/tests/metacall_node_extension_test/node_extension_test/CMakeLists.txt index ebd286752..9cbd47bc1 100644 --- a/source/tests/metacall_node_extension_test/node_extension_test/CMakeLists.txt +++ b/source/tests/metacall_node_extension_test/node_extension_test/CMakeLists.txt @@ -177,7 +177,6 @@ add_link_options(${target} PRIVATE $<$:/IGNORE:4199> $<$:/DELAYLOAD:${NodeJS_LIBRARY_NAME}> - $<$:/DELAYLOAD:${NodeJS_LIBRARY_NAME}> $<$,$>:-undefined dynamic_lookup> PUBLIC From 2a92f107dde115aaa5f49acdd03a6b81db193233 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 17:03:45 +0100 Subject: [PATCH 34/66] Trying to solve delete tag in multiplatform builds. --- .github/workflows/docker-hub-platform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-hub-platform.yml b/.github/workflows/docker-hub-platform.yml index d97b7d738..b3d706e38 100644 --- a/.github/workflows/docker-hub-platform.yml +++ b/.github/workflows/docker-hub-platform.yml @@ -156,6 +156,6 @@ jobs: curl -X DELETE \ -u "${{ secrets.DOCKER_HUB_USERNAME }}:${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" \ - "https://cloud.docker.com/v2/repositories/${DOCKER_USERNAME}/${IMAGE_NAME}/tags/${tag_to_delete}/" + "https://hub.docker.com/v2/repositories/${DOCKER_USERNAME}/${IMAGE_NAME}/tags/${tag_to_delete}/" done done From 0a40c7e407cefde43a7ce3a373fabf678adaab66 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 17:04:12 +0100 Subject: [PATCH 35/66] Set up backtrace plugin for Guix. --- .../plugins/backtrace_plugin/CMakeLists.txt | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/source/plugins/backtrace_plugin/CMakeLists.txt b/source/plugins/backtrace_plugin/CMakeLists.txt index 866e7b923..3d39838c1 100644 --- a/source/plugins/backtrace_plugin/CMakeLists.txt +++ b/source/plugins/backtrace_plugin/CMakeLists.txt @@ -7,27 +7,28 @@ endif() # External dependencies # -include(FetchContent) +if(NOT OPTION_BUILD_GUIX) + include(FetchContent) -FetchContent_Declare(BackwardCpp - GIT_REPOSITORY https://github.com/bombela/backward-cpp - GIT_TAG f30744bcf726ea3735df7ecf9e9de9ddac540283 -) + FetchContent_Declare(BackwardCpp + GIT_REPOSITORY https://github.com/bombela/backward-cpp + GIT_TAG f30744bcf726ea3735df7ecf9e9de9ddac540283 + ) -FetchContent_MakeAvailable(BackwardCpp) + FetchContent_MakeAvailable(BackwardCpp) -FetchContent_GetProperties(BackwardCpp - SOURCE_DIR BackwardCpp_SOURCE - POPULATED BackwardCpp_POPULATED -) + FetchContent_GetProperties(BackwardCpp + SOURCE_DIR BackwardCpp_SOURCE + POPULATED BackwardCpp_POPULATED + ) -if(NOT BackwardCpp_POPULATED) - FetchContent_Populate(backward-cpp) + if(NOT BackwardCpp_POPULATED) + FetchContent_Populate(backward-cpp) + endif() endif() if(NOT BackwardCpp_POPULATED OR NOT BackwardCpp_SOURCE) message(STATUS "BackwardCpp could not be installed, trying to find it on the system") - return() endif() find_package(Backward From 72599a0795e3caaa857a6cdcbc18f108a3f0dad7 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 17:04:56 +0100 Subject: [PATCH 36/66] MacOS with prebuilt node. --- tools/metacall-environment.sh | 105 ++++++++++++++++++---------------- 1 file changed, 55 insertions(+), 50 deletions(-) diff --git a/tools/metacall-environment.sh b/tools/metacall-environment.sh index d2983330b..ee77b05d0 100755 --- a/tools/metacall-environment.sh +++ b/tools/metacall-environment.sh @@ -70,6 +70,13 @@ case "$(uname -s)" in *) OPERATIVE_SYSTEM="Unknown" esac +# Architecture detection +case "$(uname -m)" in + x86_64) ARCHITECTURE="amd64";; + arm64) ARCHITECTURE="arm64";; + *) ARCHITECTURE="Unknown";; +esac + # Check out for sudo if [ "`id -u`" = '0' ]; then SUDO_CMD="" @@ -520,57 +527,55 @@ sub_nodejs(){ $SUDO_CMD apk del .build-nodejs-python-deps fi elif [ "${OPERATIVE_SYSTEM}" = "Darwin" ]; then - # TODO: Fork https://github.com/puerts/backend-nodejs or let metacall build system compile NodeJS library itself - # if [ -z "${NodeJS_BUILD_FROM_SOURCE:-}" ]; then - # # Define node location - # NODE_PREFIX="$ROOT_DIR/build" - # # Include binaries into PATH - # export PATH="$NODE_PREFIX:$PATH" - - # # Create install path - # mkdir -p "$NODE_PREFIX" - # # Install NodeJS (TODO: Implement arm64 or amd64 detection into ${arch}) - # wget -qO- https://github.com/metacall/libnode/releases/download/v22.6.0/libnode-${arch}-macos.tar.xz | tar xvJ -C $NODE_PREFIX - # # Install NPM - # wget -qO- https://registry.npmjs.org/npm/-/npm-10.8.2.tgz | tar xvz -C $NODE_PREFIX - - # # Configure NodeJS paths - # mkdir -p "$ROOT_DIR/build" - # CMAKE_CONFIG_PATH="$ROOT_DIR/build/CMakeConfig.txt" - # echo "-DNodeJS_EXECUTABLE=$NODE_PREFIX/node" >> $CMAKE_CONFIG_PATH - # echo "-DNodeJS_LIBRARY=$NODE_PREFIX/libnode.127.dylib" >> $CMAKE_CONFIG_PATH - - # # Configure NPM path - # echo "-DNPM_ROOT=$NODE_PREFIX" >> $CMAKE_CONFIG_PATH - # else - - brew install node@22 - # Make node 22 the default - brew link node@22 --force --overwrite - # Execute post install scripts - brew postinstall node@22 - # Define node location - NODE_PREFIX=$(brew --prefix node@22) - # Include binaries into PATH - export PATH="$NODE_PREFIX/bin:$PATH" - - # Configure NodeJS paths - mkdir -p "$ROOT_DIR/build" - CMAKE_CONFIG_PATH="$ROOT_DIR/build/CMakeConfig.txt" - echo "-DNodeJS_EXECUTABLE=$NODE_PREFIX/bin/node" >> $CMAKE_CONFIG_PATH - # echo "-DNodeJS_INCLUDE_DIR=$NODE_PREFIX/include/node" >> $CMAKE_CONFIG_PATH - # echo "-DNodeJS_LIBRARY=$NODE_PREFIX/lib/libnode.93.dylib" >> $CMAKE_CONFIG_PATH - - # Configure NPM path - echo "-DNPM_ROOT=$NODE_PREFIX/bin" >> $CMAKE_CONFIG_PATH - - if [ $INSTALL_C = 1 ]; then - # Required for test source/tests/metacall_node_port_c_lib_test - brew install libgit2@1.8 - brew link libgit2@1.8 --force --overwrite + # Build either using pre-compiled binaries or building node from source + if [ -z "${NodeJS_BUILD_FROM_SOURCE:-}" ]; then + # Define node location + NODE_PREFIX="$ROOT_DIR/build" + # Include binaries into PATH + export PATH="$NODE_PREFIX:$PATH" + + # Create install path + mkdir -p "$NODE_PREFIX" + + # Install NodeJS + wget -qO- https://github.com/metacall/libnode/releases/download/v22.6.0/libnode-${ARCHITECTURE}-macos.tar.xz | tar xvJ -C $NODE_PREFIX + + # Install NPM + wget -qO- https://registry.npmjs.org/npm/-/npm-10.8.2.tgz | tar xvz -C $NODE_PREFIX + + # Configure NodeJS paths + mkdir -p "$ROOT_DIR/build" + CMAKE_CONFIG_PATH="$ROOT_DIR/build/CMakeConfig.txt" + echo "-DNodeJS_EXECUTABLE=$NODE_PREFIX/node" >> $CMAKE_CONFIG_PATH + echo "-DNodeJS_LIBRARY=$NODE_PREFIX/libnode.127.dylib" >> $CMAKE_CONFIG_PATH + + # Configure NPM path + echo "-DNPM_ROOT=$NODE_PREFIX" >> $CMAKE_CONFIG_PATH + else + brew install node@22 + # Make node 22 the default + brew link node@22 --force --overwrite + # Execute post install scripts + brew postinstall node@22 + # Define node location + NODE_PREFIX=$(brew --prefix node@22) + # Include binaries into PATH + export PATH="$NODE_PREFIX/bin:$PATH" + + # Configure NodeJS paths + mkdir -p "$ROOT_DIR/build" + CMAKE_CONFIG_PATH="$ROOT_DIR/build/CMakeConfig.txt" + echo "-DNodeJS_EXECUTABLE=$NODE_PREFIX/bin/node" >> $CMAKE_CONFIG_PATH + + # Configure NPM path + echo "-DNPM_ROOT=$NODE_PREFIX/bin" >> $CMAKE_CONFIG_PATH + + if [ $INSTALL_C = 1 ]; then + # Required for test source/tests/metacall_node_port_c_lib_test + brew install libgit2@1.8 + brew link libgit2@1.8 --force --overwrite + fi fi - - # fi fi } From 7121254002143aecf1badc1018334321822b51cb Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 17:05:10 +0100 Subject: [PATCH 37/66] Add debug for makefile. --- source/loaders/node_loader/CMakeLists.txt | 1 - tools/metacall-configure.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index 1592c141c..57ddc909d 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -204,7 +204,6 @@ add_link_options(${target} PRIVATE # $<$,$>:-Wl,-undefined,dynamic_lookup> # $<$,$>:-undefined dynamic_lookup> - -Wl,-undefined,dynamic_lookup PUBLIC ${DEFAULT_LINKER_OPTIONS} diff --git a/tools/metacall-configure.sh b/tools/metacall-configure.sh index 206bc1e47..83eb973f2 100755 --- a/tools/metacall-configure.sh +++ b/tools/metacall-configure.sh @@ -532,7 +532,7 @@ sub_configure() { BUILD_STRING="$BUILD_STRING -DCMAKE_BUILD_TYPE=$BUILD_TYPE" # Execute CMake - cmake -Wno-dev -DOPTION_GIT_HOOKS=Off $BUILD_STRING .. + cmake -Wno-dev -DCMAKE_VERBOSE_MAKEFILE=ON -DOPTION_GIT_HOOKS=Off $BUILD_STRING .. } sub_help() { From bd1b230f054e700a6b161dd91a6dd24fa81965dc Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 17:18:31 +0100 Subject: [PATCH 38/66] Solve npm issues macos. --- tools/metacall-environment.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/metacall-environment.sh b/tools/metacall-environment.sh index ee77b05d0..19e4e7fd2 100755 --- a/tools/metacall-environment.sh +++ b/tools/metacall-environment.sh @@ -532,7 +532,7 @@ sub_nodejs(){ # Define node location NODE_PREFIX="$ROOT_DIR/build" # Include binaries into PATH - export PATH="$NODE_PREFIX:$PATH" + export PATH="$NODE_PREFIX:$NODE_PREFIX/bin:$PATH" # Create install path mkdir -p "$NODE_PREFIX" @@ -550,7 +550,7 @@ sub_nodejs(){ echo "-DNodeJS_LIBRARY=$NODE_PREFIX/libnode.127.dylib" >> $CMAKE_CONFIG_PATH # Configure NPM path - echo "-DNPM_ROOT=$NODE_PREFIX" >> $CMAKE_CONFIG_PATH + echo "-DNPM_ROOT=$NODE_PREFIX/bin" >> $CMAKE_CONFIG_PATH else brew install node@22 # Make node 22 the default From b1fca384079b64b12ed7fec208f35cdcf9e2ffd4 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 17:37:25 +0100 Subject: [PATCH 39/66] Solve more npn issues. --- tools/metacall-environment.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/metacall-environment.sh b/tools/metacall-environment.sh index 19e4e7fd2..f209566e1 100755 --- a/tools/metacall-environment.sh +++ b/tools/metacall-environment.sh @@ -588,6 +588,11 @@ sub_typescript(){ $SUDO_CMD npm i react@latest -g $SUDO_CMD npm i react-dom@latest -g elif [ "${OPERATIVE_SYSTEM}" = "Darwin" ]; then + if [ -z "${NodeJS_BUILD_FROM_SOURCE:-}" ]; then + # Include NPM binaries into PATH + export PATH="$ROOT_DIR/build/bin:$PATH" + fi + # Install React dependencies in order to run the tests npm i react@latest -g npm i react-dom@latest -g From 62c181c5ef1138fe9513a8b1f9d5274ed7839072 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 18:06:14 +0100 Subject: [PATCH 40/66] Trying to solve macos. --- tools/metacall-environment.sh | 65 +++++++++++++---------------------- 1 file changed, 24 insertions(+), 41 deletions(-) diff --git a/tools/metacall-environment.sh b/tools/metacall-environment.sh index f209566e1..25a24eae0 100755 --- a/tools/metacall-environment.sh +++ b/tools/metacall-environment.sh @@ -527,54 +527,42 @@ sub_nodejs(){ $SUDO_CMD apk del .build-nodejs-python-deps fi elif [ "${OPERATIVE_SYSTEM}" = "Darwin" ]; then + # Install NodeJS (required for source build or NPM itself) + brew install node@22 + # Make node 22 the default + brew link node@22 --force --overwrite + # Execute post install scripts + brew postinstall node@22 + # Define node location + NODE_PREFIX=$(brew --prefix node@22) + + # Configure NodeJS paths + mkdir -p "$ROOT_DIR/build" + CMAKE_CONFIG_PATH="$ROOT_DIR/build/CMakeConfig.txt" + + # Configure NPM path + echo "-DNPM_ROOT=$NODE_PREFIX/bin" >> $CMAKE_CONFIG_PATH + # Build either using pre-compiled binaries or building node from source if [ -z "${NodeJS_BUILD_FROM_SOURCE:-}" ]; then # Define node location NODE_PREFIX="$ROOT_DIR/build" - # Include binaries into PATH - export PATH="$NODE_PREFIX:$NODE_PREFIX/bin:$PATH" - - # Create install path - mkdir -p "$NODE_PREFIX" - # Install NodeJS wget -qO- https://github.com/metacall/libnode/releases/download/v22.6.0/libnode-${ARCHITECTURE}-macos.tar.xz | tar xvJ -C $NODE_PREFIX - - # Install NPM - wget -qO- https://registry.npmjs.org/npm/-/npm-10.8.2.tgz | tar xvz -C $NODE_PREFIX - - # Configure NodeJS paths - mkdir -p "$ROOT_DIR/build" - CMAKE_CONFIG_PATH="$ROOT_DIR/build/CMakeConfig.txt" + # Configure NodeJS path echo "-DNodeJS_EXECUTABLE=$NODE_PREFIX/node" >> $CMAKE_CONFIG_PATH - echo "-DNodeJS_LIBRARY=$NODE_PREFIX/libnode.127.dylib" >> $CMAKE_CONFIG_PATH - - # Configure NPM path - echo "-DNPM_ROOT=$NODE_PREFIX/bin" >> $CMAKE_CONFIG_PATH + echo "-DNodeJS_LIBRARY=$NODE_PREFIX/libnode.so" >> $CMAKE_CONFIG_PATH else - brew install node@22 - # Make node 22 the default - brew link node@22 --force --overwrite - # Execute post install scripts - brew postinstall node@22 - # Define node location - NODE_PREFIX=$(brew --prefix node@22) # Include binaries into PATH export PATH="$NODE_PREFIX/bin:$PATH" - - # Configure NodeJS paths - mkdir -p "$ROOT_DIR/build" - CMAKE_CONFIG_PATH="$ROOT_DIR/build/CMakeConfig.txt" + # Define executable path echo "-DNodeJS_EXECUTABLE=$NODE_PREFIX/bin/node" >> $CMAKE_CONFIG_PATH + fi - # Configure NPM path - echo "-DNPM_ROOT=$NODE_PREFIX/bin" >> $CMAKE_CONFIG_PATH - - if [ $INSTALL_C = 1 ]; then - # Required for test source/tests/metacall_node_port_c_lib_test - brew install libgit2@1.8 - brew link libgit2@1.8 --force --overwrite - fi + if [ $INSTALL_C = 1 ]; then + # Required for test source/tests/metacall_node_port_c_lib_test + brew install libgit2@1.8 + brew link libgit2@1.8 --force --overwrite fi fi } @@ -588,11 +576,6 @@ sub_typescript(){ $SUDO_CMD npm i react@latest -g $SUDO_CMD npm i react-dom@latest -g elif [ "${OPERATIVE_SYSTEM}" = "Darwin" ]; then - if [ -z "${NodeJS_BUILD_FROM_SOURCE:-}" ]; then - # Include NPM binaries into PATH - export PATH="$ROOT_DIR/build/bin:$PATH" - fi - # Install React dependencies in order to run the tests npm i react@latest -g npm i react-dom@latest -g From 2baa0f4e5563d55358d857cf07ea20bd1f14c1fd Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 18:17:12 +0100 Subject: [PATCH 41/66] Breaks make builds. --- tools/metacall-configure.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/metacall-configure.sh b/tools/metacall-configure.sh index 83eb973f2..206bc1e47 100755 --- a/tools/metacall-configure.sh +++ b/tools/metacall-configure.sh @@ -532,7 +532,7 @@ sub_configure() { BUILD_STRING="$BUILD_STRING -DCMAKE_BUILD_TYPE=$BUILD_TYPE" # Execute CMake - cmake -Wno-dev -DCMAKE_VERBOSE_MAKEFILE=ON -DOPTION_GIT_HOOKS=Off $BUILD_STRING .. + cmake -Wno-dev -DOPTION_GIT_HOOKS=Off $BUILD_STRING .. } sub_help() { From c97a026f25a989bdecdd0a8169f485f7631aa993 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 18:40:54 +0100 Subject: [PATCH 42/66] Solving issues with libnode. --- tools/metacall-environment.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/metacall-environment.sh b/tools/metacall-environment.sh index 25a24eae0..64982d14e 100755 --- a/tools/metacall-environment.sh +++ b/tools/metacall-environment.sh @@ -548,10 +548,10 @@ sub_nodejs(){ # Define node location NODE_PREFIX="$ROOT_DIR/build" # Install NodeJS - wget -qO- https://github.com/metacall/libnode/releases/download/v22.6.0/libnode-${ARCHITECTURE}-macos.tar.xz | tar xvJ -C $NODE_PREFIX + wget -qO- https://github.com/metacall/libnode/releases/download/v22.9.0/libnode-${ARCHITECTURE}-macos.tar.xz | tar xvJ -C $NODE_PREFIX # Configure NodeJS path echo "-DNodeJS_EXECUTABLE=$NODE_PREFIX/node" >> $CMAKE_CONFIG_PATH - echo "-DNodeJS_LIBRARY=$NODE_PREFIX/libnode.so" >> $CMAKE_CONFIG_PATH + echo "-DNodeJS_LIBRARY=$NODE_PREFIX/libnode.dylib" >> $CMAKE_CONFIG_PATH else # Include binaries into PATH export PATH="$NODE_PREFIX/bin:$PATH" From 662cb9b2fc6d85540922c8f1580398255cb5f262 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 20:47:58 +0100 Subject: [PATCH 43/66] Trying to make node_loader work on macos. --- source/loaders/node_loader/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index 57ddc909d..7df496c11 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -192,6 +192,7 @@ target_compile_options(${target} PUBLIC ${DEFAULT_COMPILE_OPTIONS} + -Wl,-undefined,dynamic_lookup INTERFACE ) From 67b2b5b45a14c665323ed6b42a08a7618d11ca1e Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 21:00:52 +0100 Subject: [PATCH 44/66] Trying to make node_loader work on macos 2. --- cmake/CompileOptions.cmake | 2 ++ source/loaders/node_loader/CMakeLists.txt | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/CompileOptions.cmake b/cmake/CompileOptions.cmake index a5610945c..c89fb8982 100644 --- a/cmake/CompileOptions.cmake +++ b/cmake/CompileOptions.cmake @@ -410,3 +410,5 @@ elseif(PROJECT_OS_HAIKU) -lpthread ) endif() + +set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup") diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index 7df496c11..57ddc909d 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -192,7 +192,6 @@ target_compile_options(${target} PUBLIC ${DEFAULT_COMPILE_OPTIONS} - -Wl,-undefined,dynamic_lookup INTERFACE ) From 7735599b3e7cd5da9be60a33f4090c6df54a4a63 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 21:18:34 +0100 Subject: [PATCH 45/66] Trying to make node_loader work on macos 3. --- cmake/CompileOptions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CompileOptions.cmake b/cmake/CompileOptions.cmake index c89fb8982..dfcecbe2a 100644 --- a/cmake/CompileOptions.cmake +++ b/cmake/CompileOptions.cmake @@ -411,4 +411,4 @@ elseif(PROJECT_OS_HAIKU) ) endif() -set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined,dynamic_lookup") From 3f737b02bdfea4e454220511a0c34fd6f2058071 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 21:41:54 +0100 Subject: [PATCH 46/66] Trying to make node_loader work on macos 4. --- cmake/CompileOptions.cmake | 2 -- source/loaders/node_loader/CMakeLists.txt | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmake/CompileOptions.cmake b/cmake/CompileOptions.cmake index dfcecbe2a..a5610945c 100644 --- a/cmake/CompileOptions.cmake +++ b/cmake/CompileOptions.cmake @@ -410,5 +410,3 @@ elseif(PROJECT_OS_HAIKU) -lpthread ) endif() - -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined,dynamic_lookup") diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index 57ddc909d..a448d8907 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -200,16 +200,18 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} - PRIVATE - # $<$,$>:-Wl,-undefined,dynamic_lookup> - # $<$,$>:-undefined dynamic_lookup> +set_target_properties(${target} PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup") - PUBLIC - ${DEFAULT_LINKER_OPTIONS} +# add_link_options(${target} +# PRIVATE +# # $<$,$>:-Wl,-undefined,dynamic_lookup> +# # $<$,$>:-undefined dynamic_lookup> - INTERFACE -) +# PUBLIC +# ${DEFAULT_LINKER_OPTIONS} + +# INTERFACE +# ) # # Standard options From 18e4aec6865ace48aa4415d633c1c9fa78b91b97 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 21:59:37 +0100 Subject: [PATCH 47/66] Trying to make node_loader work on macos 5. --- source/loaders/node_loader/CMakeLists.txt | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index a448d8907..5536fa202 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -200,18 +200,15 @@ target_compile_options(${target} # Linker options # -set_target_properties(${target} PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup") - -# add_link_options(${target} -# PRIVATE -# # $<$,$>:-Wl,-undefined,dynamic_lookup> -# # $<$,$>:-undefined dynamic_lookup> +target_link_options(${target} + PRIVATE + $<$,$>:-Wl,-undefined,dynamic_lookup> -# PUBLIC -# ${DEFAULT_LINKER_OPTIONS} + PUBLIC + ${DEFAULT_LINKER_OPTIONS} -# INTERFACE -# ) + INTERFACE +) # # Standard options From 7fbcce04056d9161e54f6b4f4da0fc9d01e3a4a6 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 22:45:43 +0100 Subject: [PATCH 48/66] Solve issues with macos link. --- source/adt/CMakeLists.txt | 2 +- source/benchmarks/log_bench/CMakeLists.txt | 2 +- source/benchmarks/metacall_cs_call_bench/CMakeLists.txt | 2 +- source/benchmarks/metacall_node_call_bench/CMakeLists.txt | 2 +- source/benchmarks/metacall_py_c_api_bench/CMakeLists.txt | 2 +- source/benchmarks/metacall_py_call_bench/CMakeLists.txt | 2 +- source/benchmarks/metacall_py_init_bench/CMakeLists.txt | 2 +- source/benchmarks/metacall_rb_call_bench/CMakeLists.txt | 2 +- source/cli/metacallcli/CMakeLists.txt | 2 +- source/cli/plugins/cli_core_plugin/CMakeLists.txt | 2 +- source/cli/plugins/cli_sandbox_plugin/CMakeLists.txt | 2 +- source/configuration/CMakeLists.txt | 2 +- source/detour/CMakeLists.txt | 2 +- source/detours/funchook_detour/CMakeLists.txt | 2 +- source/dynlink/CMakeLists.txt | 2 +- source/environment/CMakeLists.txt | 2 +- source/examples/metacallgui/CMakeLists.txt | 2 +- source/examples/metacalllog/CMakeLists.txt | 2 +- source/examples/metacallquine/CMakeLists.txt | 2 +- source/examples/metacallweb/CMakeLists.txt | 2 +- source/extensions/plugin_extension/CMakeLists.txt | 2 +- source/filesystem/CMakeLists.txt | 2 +- source/format/CMakeLists.txt | 2 +- source/loader/CMakeLists.txt | 2 +- source/loaders/c_loader/CMakeLists.txt | 2 +- source/loaders/cob_loader/CMakeLists.txt | 2 +- source/loaders/cr_loader/CMakeLists.txt | 2 +- source/loaders/cs_loader/CMakeLists.txt | 2 +- source/loaders/dart_loader/CMakeLists.txt | 2 +- source/loaders/ext_loader/CMakeLists.txt | 2 +- source/loaders/file_loader/CMakeLists.txt | 2 +- source/loaders/java_loader/CMakeLists.txt | 2 +- source/loaders/jl_loader/CMakeLists.txt | 2 +- source/loaders/js_loader/CMakeLists.txt | 2 +- source/loaders/jsm_loader/CMakeLists.txt | 2 +- source/loaders/llvm_loader/CMakeLists.txt | 2 +- source/loaders/lua_loader/CMakeLists.txt | 2 +- source/loaders/mock_loader/CMakeLists.txt | 2 +- source/loaders/py_loader/CMakeLists.txt | 2 +- source/loaders/rb_loader/CMakeLists.txt | 2 +- source/loaders/rpc_loader/CMakeLists.txt | 2 +- source/loaders/rs_loader/CMakeLists.txt | 2 +- source/loaders/ts_loader/CMakeLists.txt | 2 +- source/loaders/wasm_loader/CMakeLists.txt | 2 +- source/log/CMakeLists.txt | 2 +- source/memory/CMakeLists.txt | 2 +- source/metacall/CMakeLists.txt | 2 +- source/plugin/CMakeLists.txt | 2 +- source/plugins/backtrace_plugin/CMakeLists.txt | 2 +- source/plugins/sandbox_plugin/CMakeLists.txt | 2 +- source/portability/CMakeLists.txt | 2 +- source/ports/cxx_port/CMakeLists.txt | 2 +- source/ports/js_port/CMakeLists.txt | 4 ++-- source/ports/rb_port/CMakeLists.txt | 2 +- source/preprocessor/CMakeLists.txt | 2 +- source/reflect/CMakeLists.txt | 2 +- source/scripts/extension/sum/CMakeLists.txt | 2 +- source/serial/CMakeLists.txt | 2 +- source/serials/metacall_serial/CMakeLists.txt | 2 +- source/serials/rapid_json_serial/CMakeLists.txt | 2 +- source/tests/adt_map_test/CMakeLists.txt | 2 +- source/tests/adt_set_test/CMakeLists.txt | 2 +- source/tests/adt_trie_test/CMakeLists.txt | 2 +- source/tests/adt_vector_test/CMakeLists.txt | 2 +- source/tests/configuration_test/CMakeLists.txt | 2 +- source/tests/detour_test/CMakeLists.txt | 2 +- source/tests/dynlink_test/CMakeLists.txt | 2 +- source/tests/environment_test/CMakeLists.txt | 2 +- source/tests/log_custom_test/CMakeLists.txt | 2 +- source/tests/log_test/CMakeLists.txt | 2 +- source/tests/metacall_backtrace_plugin_test/CMakeLists.txt | 2 +- source/tests/metacall_c_lib_test/CMakeLists.txt | 2 +- source/tests/metacall_c_test/CMakeLists.txt | 2 +- source/tests/metacall_callback_complex_test/CMakeLists.txt | 2 +- source/tests/metacall_cast_test/CMakeLists.txt | 2 +- source/tests/metacall_clear_test/CMakeLists.txt | 2 +- .../tests/metacall_cli_core_plugin_await_test/CMakeLists.txt | 2 +- source/tests/metacall_cli_core_plugin_test/CMakeLists.txt | 2 +- source/tests/metacall_cobol_test/CMakeLists.txt | 2 +- .../tests/metacall_configuration_default_test/CMakeLists.txt | 2 +- .../metacall_configuration_exec_path_test/CMakeLists.txt | 2 +- source/tests/metacall_cs_test/CMakeLists.txt | 2 +- source/tests/metacall_csharp_function_test/CMakeLists.txt | 2 +- source/tests/metacall_csharp_static_class_test/CMakeLists.txt | 2 +- source/tests/metacall_depends_test/CMakeLists.txt | 2 +- source/tests/metacall_distributable_test/CMakeLists.txt | 2 +- source/tests/metacall_ducktype_test/CMakeLists.txt | 2 +- source/tests/metacall_duplicated_handle_test/CMakeLists.txt | 2 +- source/tests/metacall_duplicated_symbols_test/CMakeLists.txt | 2 +- source/tests/metacall_dynlink_path_test/CMakeLists.txt | 2 +- source/tests/metacall_ext_test/CMakeLists.txt | 2 +- source/tests/metacall_file_fail_test/CMakeLists.txt | 2 +- source/tests/metacall_file_glob_test/CMakeLists.txt | 2 +- source/tests/metacall_file_test/CMakeLists.txt | 2 +- source/tests/metacall_fork_test/CMakeLists.txt | 2 +- source/tests/metacall_function_test/CMakeLists.txt | 2 +- source/tests/metacall_handle_export_test/CMakeLists.txt | 2 +- source/tests/metacall_handle_get_test/CMakeLists.txt | 2 +- source/tests/metacall_init_fini_test/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../metacall_initialize_destroy_multiple_test/CMakeLists.txt | 2 +- source/tests/metacall_initialize_ex_test/CMakeLists.txt | 2 +- source/tests/metacall_initialize_test/CMakeLists.txt | 2 +- source/tests/metacall_inspect_test/CMakeLists.txt | 2 +- source/tests/metacall_integration_test/CMakeLists.txt | 2 +- source/tests/metacall_invalid_loader_test/CMakeLists.txt | 2 +- source/tests/metacall_java_test/CMakeLists.txt | 2 +- source/tests/metacall_julia_test/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- source/tests/metacall_llvm_test/CMakeLists.txt | 2 +- .../metacall_load_configuration_fail_test/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../metacall_load_configuration_relative_test/CMakeLists.txt | 2 +- source/tests/metacall_load_configuration_test/CMakeLists.txt | 2 +- source/tests/metacall_load_memory_empty_test/CMakeLists.txt | 2 +- source/tests/metacall_load_memory_test/CMakeLists.txt | 2 +- source/tests/metacall_logs_test/CMakeLists.txt | 2 +- source/tests/metacall_lua_test/CMakeLists.txt | 2 +- source/tests/metacall_map_await_test/CMakeLists.txt | 2 +- source/tests/metacall_map_test/CMakeLists.txt | 2 +- source/tests/metacall_node_async_multiple_test/CMakeLists.txt | 2 +- .../tests/metacall_node_async_resources_test/CMakeLists.txt | 2 +- source/tests/metacall_node_async_test/CMakeLists.txt | 2 +- source/tests/metacall_node_await_chain_test/CMakeLists.txt | 2 +- source/tests/metacall_node_call_test/CMakeLists.txt | 2 +- source/tests/metacall_node_callback_test/CMakeLists.txt | 2 +- source/tests/metacall_node_clear_mem_test/CMakeLists.txt | 2 +- source/tests/metacall_node_default_export_test/CMakeLists.txt | 2 +- .../tests/metacall_node_event_loop_signal_test/CMakeLists.txt | 2 +- source/tests/metacall_node_event_loop_test/CMakeLists.txt | 2 +- source/tests/metacall_node_exception_test/CMakeLists.txt | 2 +- source/tests/metacall_node_extension_test/CMakeLists.txt | 2 +- .../node_extension_test/CMakeLists.txt | 2 +- source/tests/metacall_node_fail_env_var_test/CMakeLists.txt | 2 +- source/tests/metacall_node_fail_load_leak_test/CMakeLists.txt | 2 +- source/tests/metacall_node_fail_test/CMakeLists.txt | 2 +- source/tests/metacall_node_inline_test/CMakeLists.txt | 2 +- .../metacall_node_multithread_deadlock_test/CMakeLists.txt | 2 +- source/tests/metacall_node_native_code_test/CMakeLists.txt | 2 +- source/tests/metacall_node_port_await_test/CMakeLists.txt | 2 +- source/tests/metacall_node_port_c_lib_test/CMakeLists.txt | 2 +- source/tests/metacall_node_port_rs_test/CMakeLists.txt | 2 +- source/tests/metacall_node_port_test/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../metacall_node_python_await_extended_test/CMakeLists.txt | 2 +- source/tests/metacall_node_python_await_test/CMakeLists.txt | 2 +- .../tests/metacall_node_python_deadlock_test/CMakeLists.txt | 2 +- .../tests/metacall_node_python_exception_test/CMakeLists.txt | 2 +- .../tests/metacall_node_python_port_mock_test/CMakeLists.txt | 2 +- .../tests/metacall_node_python_port_ruby_test/CMakeLists.txt | 2 +- source/tests/metacall_node_python_ruby_test/CMakeLists.txt | 2 +- source/tests/metacall_node_reentrant_test/CMakeLists.txt | 2 +- source/tests/metacall_node_signal_handler_test/CMakeLists.txt | 2 +- source/tests/metacall_node_test/CMakeLists.txt | 2 +- source/tests/metacall_node_typescript_test/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../tests/metacall_plugin_extension_local_test/CMakeLists.txt | 2 +- source/tests/metacall_plugin_extension_test/CMakeLists.txt | 2 +- source/tests/metacall_python_async_test/CMakeLists.txt | 2 +- source/tests/metacall_python_await_test/CMakeLists.txt | 2 +- source/tests/metacall_python_builtins_test/CMakeLists.txt | 2 +- source/tests/metacall_python_callback_test/CMakeLists.txt | 2 +- source/tests/metacall_python_dict_test/CMakeLists.txt | 2 +- source/tests/metacall_python_exception_test/CMakeLists.txt | 2 +- source/tests/metacall_python_fail_test/CMakeLists.txt | 2 +- source/tests/metacall_python_gc_test/CMakeLists.txt | 2 +- source/tests/metacall_python_loader_port_test/CMakeLists.txt | 2 +- source/tests/metacall_python_model_test/CMakeLists.txt | 2 +- source/tests/metacall_python_node_await_test/CMakeLists.txt | 2 +- source/tests/metacall_python_object_class_test/CMakeLists.txt | 2 +- source/tests/metacall_python_open_test/CMakeLists.txt | 2 +- source/tests/metacall_python_pointer_test/CMakeLists.txt | 2 +- .../tests/metacall_python_port_callback_test/CMakeLists.txt | 2 +- source/tests/metacall_python_port_https_test/CMakeLists.txt | 2 +- source/tests/metacall_python_port_import_test/CMakeLists.txt | 2 +- source/tests/metacall_python_port_pointer_test/CMakeLists.txt | 2 +- source/tests/metacall_python_port_test/CMakeLists.txt | 2 +- source/tests/metacall_python_reentrant_test/CMakeLists.txt | 2 +- .../tests/metacall_python_relative_path_test/CMakeLists.txt | 2 +- source/tests/metacall_python_test/CMakeLists.txt | 2 +- source/tests/metacall_python_varargs_test/CMakeLists.txt | 2 +- .../metacall_python_without_env_vars_test/CMakeLists.txt | 2 +- .../metacall_python_without_functions_test/CMakeLists.txt | 2 +- source/tests/metacall_reinitialize_test/CMakeLists.txt | 2 +- source/tests/metacall_reload_functions_test/CMakeLists.txt | 2 +- source/tests/metacall_return_monad_test/CMakeLists.txt | 2 +- source/tests/metacall_rpc_test/CMakeLists.txt | 2 +- source/tests/metacall_ruby_fail_empty_test/CMakeLists.txt | 2 +- source/tests/metacall_ruby_fail_test/CMakeLists.txt | 2 +- source/tests/metacall_ruby_object_class_test/CMakeLists.txt | 2 +- .../metacall_ruby_parser_integration_test/CMakeLists.txt | 2 +- .../tests/metacall_ruby_rails_integration_test/CMakeLists.txt | 2 +- source/tests/metacall_ruby_test/CMakeLists.txt | 2 +- source/tests/metacall_rust_class_test/CMakeLists.txt | 2 +- source/tests/metacall_rust_load_from_mem_test/CMakeLists.txt | 2 +- .../metacall_rust_load_from_package_class_test/CMakeLists.txt | 2 +- .../metacall_rust_load_from_package_dep_test/CMakeLists.txt | 2 +- .../tests/metacall_rust_load_from_package_test/CMakeLists.txt | 2 +- source/tests/metacall_rust_test/CMakeLists.txt | 2 +- source/tests/metacall_sandbox_plugin_test/CMakeLists.txt | 2 +- source/tests/metacall_test/CMakeLists.txt | 2 +- source/tests/metacall_typescript_call_map_test/CMakeLists.txt | 2 +- .../tests/metacall_typescript_jsx_default_test/CMakeLists.txt | 2 +- source/tests/metacall_typescript_node_test/CMakeLists.txt | 2 +- source/tests/metacall_typescript_require_test/CMakeLists.txt | 2 +- source/tests/metacall_typescript_test/CMakeLists.txt | 2 +- .../metacall_typescript_tsx_loop_fail_test/CMakeLists.txt | 2 +- source/tests/metacall_typescript_tsx_test/CMakeLists.txt | 2 +- source/tests/metacall_version_test/CMakeLists.txt | 2 +- source/tests/metacall_wasm_python_port_test/CMakeLists.txt | 2 +- source/tests/metacall_wasm_test/CMakeLists.txt | 2 +- source/tests/portability_path_test/CMakeLists.txt | 2 +- source/tests/preprocessor_test/CMakeLists.txt | 2 +- source/tests/rb_loader_parser_test/CMakeLists.txt | 2 +- source/tests/reflect_function_test/CMakeLists.txt | 2 +- source/tests/reflect_metadata_test/CMakeLists.txt | 2 +- source/tests/reflect_object_class_test/CMakeLists.txt | 2 +- source/tests/reflect_scope_test/CMakeLists.txt | 2 +- source/tests/reflect_value_cast_test/CMakeLists.txt | 2 +- source/tests/serial_test/CMakeLists.txt | 2 +- source/threading/CMakeLists.txt | 2 +- source/version/CMakeLists.txt | 2 +- 224 files changed, 225 insertions(+), 225 deletions(-) diff --git a/source/adt/CMakeLists.txt b/source/adt/CMakeLists.txt index e97f2f59b..6083509df 100644 --- a/source/adt/CMakeLists.txt +++ b/source/adt/CMakeLists.txt @@ -164,7 +164,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/benchmarks/log_bench/CMakeLists.txt b/source/benchmarks/log_bench/CMakeLists.txt index 1c1175337..f1ba5575e 100644 --- a/source/benchmarks/log_bench/CMakeLists.txt +++ b/source/benchmarks/log_bench/CMakeLists.txt @@ -108,7 +108,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/benchmarks/metacall_cs_call_bench/CMakeLists.txt b/source/benchmarks/metacall_cs_call_bench/CMakeLists.txt index 751b4a034..80db3ce39 100644 --- a/source/benchmarks/metacall_cs_call_bench/CMakeLists.txt +++ b/source/benchmarks/metacall_cs_call_bench/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/benchmarks/metacall_node_call_bench/CMakeLists.txt b/source/benchmarks/metacall_node_call_bench/CMakeLists.txt index 8b9c696bb..16ae8e768 100644 --- a/source/benchmarks/metacall_node_call_bench/CMakeLists.txt +++ b/source/benchmarks/metacall_node_call_bench/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/benchmarks/metacall_py_c_api_bench/CMakeLists.txt b/source/benchmarks/metacall_py_c_api_bench/CMakeLists.txt index 0c0ee17bc..08605fb08 100644 --- a/source/benchmarks/metacall_py_c_api_bench/CMakeLists.txt +++ b/source/benchmarks/metacall_py_c_api_bench/CMakeLists.txt @@ -121,7 +121,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/benchmarks/metacall_py_call_bench/CMakeLists.txt b/source/benchmarks/metacall_py_call_bench/CMakeLists.txt index bbc6b3376..9ed674422 100644 --- a/source/benchmarks/metacall_py_call_bench/CMakeLists.txt +++ b/source/benchmarks/metacall_py_call_bench/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/benchmarks/metacall_py_init_bench/CMakeLists.txt b/source/benchmarks/metacall_py_init_bench/CMakeLists.txt index 1aff472c3..eb9ecb2c7 100644 --- a/source/benchmarks/metacall_py_init_bench/CMakeLists.txt +++ b/source/benchmarks/metacall_py_init_bench/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/benchmarks/metacall_rb_call_bench/CMakeLists.txt b/source/benchmarks/metacall_rb_call_bench/CMakeLists.txt index fc66c3230..4833bad0d 100644 --- a/source/benchmarks/metacall_rb_call_bench/CMakeLists.txt +++ b/source/benchmarks/metacall_rb_call_bench/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/cli/metacallcli/CMakeLists.txt b/source/cli/metacallcli/CMakeLists.txt index 227a81cfd..7d2183283 100644 --- a/source/cli/metacallcli/CMakeLists.txt +++ b/source/cli/metacallcli/CMakeLists.txt @@ -139,7 +139,7 @@ target_compile_features(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/cli/plugins/cli_core_plugin/CMakeLists.txt b/source/cli/plugins/cli_core_plugin/CMakeLists.txt index 1e353e4d4..680417f11 100644 --- a/source/cli/plugins/cli_core_plugin/CMakeLists.txt +++ b/source/cli/plugins/cli_core_plugin/CMakeLists.txt @@ -180,7 +180,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/cli/plugins/cli_sandbox_plugin/CMakeLists.txt b/source/cli/plugins/cli_sandbox_plugin/CMakeLists.txt index 3c777caf8..de380e948 100644 --- a/source/cli/plugins/cli_sandbox_plugin/CMakeLists.txt +++ b/source/cli/plugins/cli_sandbox_plugin/CMakeLists.txt @@ -175,7 +175,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/configuration/CMakeLists.txt b/source/configuration/CMakeLists.txt index 6c5204d8f..4097b1d54 100644 --- a/source/configuration/CMakeLists.txt +++ b/source/configuration/CMakeLists.txt @@ -164,7 +164,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/detour/CMakeLists.txt b/source/detour/CMakeLists.txt index fafc41c6f..19e3a6919 100644 --- a/source/detour/CMakeLists.txt +++ b/source/detour/CMakeLists.txt @@ -157,7 +157,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index 74c39ef67..afd225e3d 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -214,7 +214,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/dynlink/CMakeLists.txt b/source/dynlink/CMakeLists.txt index 33a62eaa7..8a9d6aed6 100644 --- a/source/dynlink/CMakeLists.txt +++ b/source/dynlink/CMakeLists.txt @@ -168,7 +168,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/environment/CMakeLists.txt b/source/environment/CMakeLists.txt index 34c36271b..28b99aa95 100644 --- a/source/environment/CMakeLists.txt +++ b/source/environment/CMakeLists.txt @@ -150,7 +150,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/examples/metacallgui/CMakeLists.txt b/source/examples/metacallgui/CMakeLists.txt index 8bfa9b958..485521f88 100644 --- a/source/examples/metacallgui/CMakeLists.txt +++ b/source/examples/metacallgui/CMakeLists.txt @@ -125,7 +125,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/examples/metacalllog/CMakeLists.txt b/source/examples/metacalllog/CMakeLists.txt index 5a180105b..6b4f8d234 100644 --- a/source/examples/metacalllog/CMakeLists.txt +++ b/source/examples/metacalllog/CMakeLists.txt @@ -93,7 +93,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/examples/metacallquine/CMakeLists.txt b/source/examples/metacallquine/CMakeLists.txt index 299a45762..0da78c404 100644 --- a/source/examples/metacallquine/CMakeLists.txt +++ b/source/examples/metacallquine/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/examples/metacallweb/CMakeLists.txt b/source/examples/metacallweb/CMakeLists.txt index b4e9c095d..6c81c8b2e 100644 --- a/source/examples/metacallweb/CMakeLists.txt +++ b/source/examples/metacallweb/CMakeLists.txt @@ -99,7 +99,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/extensions/plugin_extension/CMakeLists.txt b/source/extensions/plugin_extension/CMakeLists.txt index 6873958a2..31baf3fba 100644 --- a/source/extensions/plugin_extension/CMakeLists.txt +++ b/source/extensions/plugin_extension/CMakeLists.txt @@ -161,7 +161,7 @@ target_compile_features(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/filesystem/CMakeLists.txt b/source/filesystem/CMakeLists.txt index 472863df3..56024183d 100644 --- a/source/filesystem/CMakeLists.txt +++ b/source/filesystem/CMakeLists.txt @@ -181,7 +181,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/format/CMakeLists.txt b/source/format/CMakeLists.txt index 46d4ba545..1bf3e2c7f 100644 --- a/source/format/CMakeLists.txt +++ b/source/format/CMakeLists.txt @@ -147,7 +147,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loader/CMakeLists.txt b/source/loader/CMakeLists.txt index dad99a6b7..953a5f3ef 100644 --- a/source/loader/CMakeLists.txt +++ b/source/loader/CMakeLists.txt @@ -170,7 +170,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/c_loader/CMakeLists.txt b/source/loaders/c_loader/CMakeLists.txt index 729466872..e418078d9 100644 --- a/source/loaders/c_loader/CMakeLists.txt +++ b/source/loaders/c_loader/CMakeLists.txt @@ -203,7 +203,7 @@ target_compile_features(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/cob_loader/CMakeLists.txt b/source/loaders/cob_loader/CMakeLists.txt index 19890f7d5..a22cbf01e 100644 --- a/source/loaders/cob_loader/CMakeLists.txt +++ b/source/loaders/cob_loader/CMakeLists.txt @@ -162,7 +162,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/cr_loader/CMakeLists.txt b/source/loaders/cr_loader/CMakeLists.txt index b0ab7ba89..305875d48 100644 --- a/source/loaders/cr_loader/CMakeLists.txt +++ b/source/loaders/cr_loader/CMakeLists.txt @@ -154,7 +154,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/cs_loader/CMakeLists.txt b/source/loaders/cs_loader/CMakeLists.txt index c872d0f24..37b4a7ac2 100644 --- a/source/loaders/cs_loader/CMakeLists.txt +++ b/source/loaders/cs_loader/CMakeLists.txt @@ -222,7 +222,7 @@ target_compile_features(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/dart_loader/CMakeLists.txt b/source/loaders/dart_loader/CMakeLists.txt index 6355e44cd..b6b48df1f 100644 --- a/source/loaders/dart_loader/CMakeLists.txt +++ b/source/loaders/dart_loader/CMakeLists.txt @@ -165,7 +165,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/ext_loader/CMakeLists.txt b/source/loaders/ext_loader/CMakeLists.txt index b2a9545f9..3efbb1d66 100644 --- a/source/loaders/ext_loader/CMakeLists.txt +++ b/source/loaders/ext_loader/CMakeLists.txt @@ -163,7 +163,7 @@ target_compile_features(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/file_loader/CMakeLists.txt b/source/loaders/file_loader/CMakeLists.txt index 0f03daec2..0a3ec02b3 100644 --- a/source/loaders/file_loader/CMakeLists.txt +++ b/source/loaders/file_loader/CMakeLists.txt @@ -154,7 +154,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/java_loader/CMakeLists.txt b/source/loaders/java_loader/CMakeLists.txt index c9b4d5857..c59eaa59a 100644 --- a/source/loaders/java_loader/CMakeLists.txt +++ b/source/loaders/java_loader/CMakeLists.txt @@ -175,7 +175,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/jl_loader/CMakeLists.txt b/source/loaders/jl_loader/CMakeLists.txt index 8c1109f2f..d628b69cd 100644 --- a/source/loaders/jl_loader/CMakeLists.txt +++ b/source/loaders/jl_loader/CMakeLists.txt @@ -180,7 +180,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/js_loader/CMakeLists.txt b/source/loaders/js_loader/CMakeLists.txt index dfa627ff9..c6e599df2 100644 --- a/source/loaders/js_loader/CMakeLists.txt +++ b/source/loaders/js_loader/CMakeLists.txt @@ -171,7 +171,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/jsm_loader/CMakeLists.txt b/source/loaders/jsm_loader/CMakeLists.txt index 36accd7ed..00266a3f2 100644 --- a/source/loaders/jsm_loader/CMakeLists.txt +++ b/source/loaders/jsm_loader/CMakeLists.txt @@ -169,7 +169,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/llvm_loader/CMakeLists.txt b/source/loaders/llvm_loader/CMakeLists.txt index 7755ecf18..954eba5d1 100644 --- a/source/loaders/llvm_loader/CMakeLists.txt +++ b/source/loaders/llvm_loader/CMakeLists.txt @@ -169,7 +169,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/lua_loader/CMakeLists.txt b/source/loaders/lua_loader/CMakeLists.txt index 6a735bbd7..6816c8284 100644 --- a/source/loaders/lua_loader/CMakeLists.txt +++ b/source/loaders/lua_loader/CMakeLists.txt @@ -167,7 +167,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/mock_loader/CMakeLists.txt b/source/loaders/mock_loader/CMakeLists.txt index 60cd93043..6fb2c80dc 100644 --- a/source/loaders/mock_loader/CMakeLists.txt +++ b/source/loaders/mock_loader/CMakeLists.txt @@ -154,7 +154,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/py_loader/CMakeLists.txt b/source/loaders/py_loader/CMakeLists.txt index 105bfae2c..b2957ff0f 100644 --- a/source/loaders/py_loader/CMakeLists.txt +++ b/source/loaders/py_loader/CMakeLists.txt @@ -209,7 +209,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/rb_loader/CMakeLists.txt b/source/loaders/rb_loader/CMakeLists.txt index 8259079b4..e74b89540 100644 --- a/source/loaders/rb_loader/CMakeLists.txt +++ b/source/loaders/rb_loader/CMakeLists.txt @@ -186,7 +186,7 @@ endif() # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/rpc_loader/CMakeLists.txt b/source/loaders/rpc_loader/CMakeLists.txt index c81839aef..8cbb72f12 100644 --- a/source/loaders/rpc_loader/CMakeLists.txt +++ b/source/loaders/rpc_loader/CMakeLists.txt @@ -171,7 +171,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/rs_loader/CMakeLists.txt b/source/loaders/rs_loader/CMakeLists.txt index 4c97cf599..aa84cbcce 100644 --- a/source/loaders/rs_loader/CMakeLists.txt +++ b/source/loaders/rs_loader/CMakeLists.txt @@ -177,7 +177,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/ts_loader/CMakeLists.txt b/source/loaders/ts_loader/CMakeLists.txt index 076f40dc7..b76112250 100644 --- a/source/loaders/ts_loader/CMakeLists.txt +++ b/source/loaders/ts_loader/CMakeLists.txt @@ -164,7 +164,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/loaders/wasm_loader/CMakeLists.txt b/source/loaders/wasm_loader/CMakeLists.txt index 20ada2d79..c51d56713 100644 --- a/source/loaders/wasm_loader/CMakeLists.txt +++ b/source/loaders/wasm_loader/CMakeLists.txt @@ -174,7 +174,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/log/CMakeLists.txt b/source/log/CMakeLists.txt index 556c17aae..bce9dc593 100644 --- a/source/log/CMakeLists.txt +++ b/source/log/CMakeLists.txt @@ -220,7 +220,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/memory/CMakeLists.txt b/source/memory/CMakeLists.txt index 17a4b1b1c..043812e4a 100644 --- a/source/memory/CMakeLists.txt +++ b/source/memory/CMakeLists.txt @@ -161,7 +161,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/metacall/CMakeLists.txt b/source/metacall/CMakeLists.txt index ec669d7f0..7aefaabd1 100644 --- a/source/metacall/CMakeLists.txt +++ b/source/metacall/CMakeLists.txt @@ -244,7 +244,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/plugin/CMakeLists.txt b/source/plugin/CMakeLists.txt index c46756f36..871d222b3 100644 --- a/source/plugin/CMakeLists.txt +++ b/source/plugin/CMakeLists.txt @@ -163,7 +163,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/plugins/backtrace_plugin/CMakeLists.txt b/source/plugins/backtrace_plugin/CMakeLists.txt index 3d39838c1..ba955b7d8 100644 --- a/source/plugins/backtrace_plugin/CMakeLists.txt +++ b/source/plugins/backtrace_plugin/CMakeLists.txt @@ -217,7 +217,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/plugins/sandbox_plugin/CMakeLists.txt b/source/plugins/sandbox_plugin/CMakeLists.txt index 1197f9760..e570a9528 100644 --- a/source/plugins/sandbox_plugin/CMakeLists.txt +++ b/source/plugins/sandbox_plugin/CMakeLists.txt @@ -196,7 +196,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/portability/CMakeLists.txt b/source/portability/CMakeLists.txt index 65b9dd1f2..1855258d2 100644 --- a/source/portability/CMakeLists.txt +++ b/source/portability/CMakeLists.txt @@ -158,7 +158,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/ports/cxx_port/CMakeLists.txt b/source/ports/cxx_port/CMakeLists.txt index 07b94e752..bc450a068 100644 --- a/source/ports/cxx_port/CMakeLists.txt +++ b/source/ports/cxx_port/CMakeLists.txt @@ -147,7 +147,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/ports/js_port/CMakeLists.txt b/source/ports/js_port/CMakeLists.txt index 447e1fc10..8613fc33b 100644 --- a/source/ports/js_port/CMakeLists.txt +++ b/source/ports/js_port/CMakeLists.txt @@ -213,7 +213,7 @@ target_compile_options(${SWIG_MODULE_${target}_REAL_NAME} # Linker options # -add_link_options(${SWIG_MODULE_${target}_REAL_NAME} +target_link_options(${SWIG_MODULE_${target}_REAL_NAME} PRIVATE PUBLIC @@ -380,7 +380,7 @@ target_compile_options(${js_port_test} # Linker options # -add_link_options(${js_port_test} +target_link_options(${js_port_test} PRIVATE PUBLIC diff --git a/source/ports/rb_port/CMakeLists.txt b/source/ports/rb_port/CMakeLists.txt index 0e9e574fc..d22778818 100644 --- a/source/ports/rb_port/CMakeLists.txt +++ b/source/ports/rb_port/CMakeLists.txt @@ -237,7 +237,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${SWIG_MODULE_${target}_REAL_NAME} +target_link_options(${SWIG_MODULE_${target}_REAL_NAME} PRIVATE PUBLIC diff --git a/source/preprocessor/CMakeLists.txt b/source/preprocessor/CMakeLists.txt index e3c7016ad..a850683fc 100644 --- a/source/preprocessor/CMakeLists.txt +++ b/source/preprocessor/CMakeLists.txt @@ -179,7 +179,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/reflect/CMakeLists.txt b/source/reflect/CMakeLists.txt index 04921ad52..0131e0453 100644 --- a/source/reflect/CMakeLists.txt +++ b/source/reflect/CMakeLists.txt @@ -203,7 +203,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/scripts/extension/sum/CMakeLists.txt b/source/scripts/extension/sum/CMakeLists.txt index c076de1e1..735866c14 100644 --- a/source/scripts/extension/sum/CMakeLists.txt +++ b/source/scripts/extension/sum/CMakeLists.txt @@ -152,7 +152,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/serial/CMakeLists.txt b/source/serial/CMakeLists.txt index 9a7a5b1e1..87de042a1 100644 --- a/source/serial/CMakeLists.txt +++ b/source/serial/CMakeLists.txt @@ -158,7 +158,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/serials/metacall_serial/CMakeLists.txt b/source/serials/metacall_serial/CMakeLists.txt index 66160ee09..5a11cbc8e 100644 --- a/source/serials/metacall_serial/CMakeLists.txt +++ b/source/serials/metacall_serial/CMakeLists.txt @@ -158,7 +158,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/serials/rapid_json_serial/CMakeLists.txt b/source/serials/rapid_json_serial/CMakeLists.txt index aa2b18935..29fd739aa 100644 --- a/source/serials/rapid_json_serial/CMakeLists.txt +++ b/source/serials/rapid_json_serial/CMakeLists.txt @@ -191,7 +191,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/tests/adt_map_test/CMakeLists.txt b/source/tests/adt_map_test/CMakeLists.txt index 45bca49c8..29ae7e7e9 100644 --- a/source/tests/adt_map_test/CMakeLists.txt +++ b/source/tests/adt_map_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/adt_set_test/CMakeLists.txt b/source/tests/adt_set_test/CMakeLists.txt index 21972409d..d46b7064f 100644 --- a/source/tests/adt_set_test/CMakeLists.txt +++ b/source/tests/adt_set_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/adt_trie_test/CMakeLists.txt b/source/tests/adt_trie_test/CMakeLists.txt index 28305388b..1bac7e403 100644 --- a/source/tests/adt_trie_test/CMakeLists.txt +++ b/source/tests/adt_trie_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/adt_vector_test/CMakeLists.txt b/source/tests/adt_vector_test/CMakeLists.txt index cc085cb1b..dab9ae9a6 100644 --- a/source/tests/adt_vector_test/CMakeLists.txt +++ b/source/tests/adt_vector_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/configuration_test/CMakeLists.txt b/source/tests/configuration_test/CMakeLists.txt index e749dc9c5..c9f804954 100644 --- a/source/tests/configuration_test/CMakeLists.txt +++ b/source/tests/configuration_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/detour_test/CMakeLists.txt b/source/tests/detour_test/CMakeLists.txt index b84f0f4a5..7b722beeb 100644 --- a/source/tests/detour_test/CMakeLists.txt +++ b/source/tests/detour_test/CMakeLists.txt @@ -121,7 +121,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/dynlink_test/CMakeLists.txt b/source/tests/dynlink_test/CMakeLists.txt index 53718d407..d0e0d844d 100644 --- a/source/tests/dynlink_test/CMakeLists.txt +++ b/source/tests/dynlink_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/environment_test/CMakeLists.txt b/source/tests/environment_test/CMakeLists.txt index 7a7575d46..ec3e14449 100644 --- a/source/tests/environment_test/CMakeLists.txt +++ b/source/tests/environment_test/CMakeLists.txt @@ -107,7 +107,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/log_custom_test/CMakeLists.txt b/source/tests/log_custom_test/CMakeLists.txt index 4793ab64a..73ef1f64a 100644 --- a/source/tests/log_custom_test/CMakeLists.txt +++ b/source/tests/log_custom_test/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/log_test/CMakeLists.txt b/source/tests/log_test/CMakeLists.txt index 8fe8cca09..d3f70ddc3 100644 --- a/source/tests/log_test/CMakeLists.txt +++ b/source/tests/log_test/CMakeLists.txt @@ -109,7 +109,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_backtrace_plugin_test/CMakeLists.txt b/source/tests/metacall_backtrace_plugin_test/CMakeLists.txt index 2d5ad256a..013b1d742 100644 --- a/source/tests/metacall_backtrace_plugin_test/CMakeLists.txt +++ b/source/tests/metacall_backtrace_plugin_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_c_lib_test/CMakeLists.txt b/source/tests/metacall_c_lib_test/CMakeLists.txt index d4d7aa561..eace7e1da 100644 --- a/source/tests/metacall_c_lib_test/CMakeLists.txt +++ b/source/tests/metacall_c_lib_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_c_test/CMakeLists.txt b/source/tests/metacall_c_test/CMakeLists.txt index 76188b304..7599f98cb 100644 --- a/source/tests/metacall_c_test/CMakeLists.txt +++ b/source/tests/metacall_c_test/CMakeLists.txt @@ -124,7 +124,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_callback_complex_test/CMakeLists.txt b/source/tests/metacall_callback_complex_test/CMakeLists.txt index c6c54a96a..00183a9c2 100644 --- a/source/tests/metacall_callback_complex_test/CMakeLists.txt +++ b/source/tests/metacall_callback_complex_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_cast_test/CMakeLists.txt b/source/tests/metacall_cast_test/CMakeLists.txt index 4880ebe39..ec7b1876b 100644 --- a/source/tests/metacall_cast_test/CMakeLists.txt +++ b/source/tests/metacall_cast_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_clear_test/CMakeLists.txt b/source/tests/metacall_clear_test/CMakeLists.txt index 32591ebc4..bb461a5e9 100644 --- a/source/tests/metacall_clear_test/CMakeLists.txt +++ b/source/tests/metacall_clear_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_cli_core_plugin_await_test/CMakeLists.txt b/source/tests/metacall_cli_core_plugin_await_test/CMakeLists.txt index 8bb9fa0bc..9c444e084 100644 --- a/source/tests/metacall_cli_core_plugin_await_test/CMakeLists.txt +++ b/source/tests/metacall_cli_core_plugin_await_test/CMakeLists.txt @@ -123,7 +123,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_cli_core_plugin_test/CMakeLists.txt b/source/tests/metacall_cli_core_plugin_test/CMakeLists.txt index 1f50fb8ca..8de5b40ef 100644 --- a/source/tests/metacall_cli_core_plugin_test/CMakeLists.txt +++ b/source/tests/metacall_cli_core_plugin_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_cobol_test/CMakeLists.txt b/source/tests/metacall_cobol_test/CMakeLists.txt index 1c66d2dd2..c524b462c 100644 --- a/source/tests/metacall_cobol_test/CMakeLists.txt +++ b/source/tests/metacall_cobol_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_configuration_default_test/CMakeLists.txt b/source/tests/metacall_configuration_default_test/CMakeLists.txt index 589eeb1d1..571fc6786 100644 --- a/source/tests/metacall_configuration_default_test/CMakeLists.txt +++ b/source/tests/metacall_configuration_default_test/CMakeLists.txt @@ -129,7 +129,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_configuration_exec_path_test/CMakeLists.txt b/source/tests/metacall_configuration_exec_path_test/CMakeLists.txt index af15809f2..e63ff23b9 100644 --- a/source/tests/metacall_configuration_exec_path_test/CMakeLists.txt +++ b/source/tests/metacall_configuration_exec_path_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_cs_test/CMakeLists.txt b/source/tests/metacall_cs_test/CMakeLists.txt index 5859e5a82..084e5f819 100644 --- a/source/tests/metacall_cs_test/CMakeLists.txt +++ b/source/tests/metacall_cs_test/CMakeLists.txt @@ -117,7 +117,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_csharp_function_test/CMakeLists.txt b/source/tests/metacall_csharp_function_test/CMakeLists.txt index e89890969..53e8df1ac 100644 --- a/source/tests/metacall_csharp_function_test/CMakeLists.txt +++ b/source/tests/metacall_csharp_function_test/CMakeLists.txt @@ -125,7 +125,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_csharp_static_class_test/CMakeLists.txt b/source/tests/metacall_csharp_static_class_test/CMakeLists.txt index 1c43f950a..9b04dac50 100644 --- a/source/tests/metacall_csharp_static_class_test/CMakeLists.txt +++ b/source/tests/metacall_csharp_static_class_test/CMakeLists.txt @@ -125,7 +125,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_depends_test/CMakeLists.txt b/source/tests/metacall_depends_test/CMakeLists.txt index 4fab09eae..ddc10ae8d 100644 --- a/source/tests/metacall_depends_test/CMakeLists.txt +++ b/source/tests/metacall_depends_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_distributable_test/CMakeLists.txt b/source/tests/metacall_distributable_test/CMakeLists.txt index 257189724..87354950d 100644 --- a/source/tests/metacall_distributable_test/CMakeLists.txt +++ b/source/tests/metacall_distributable_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ducktype_test/CMakeLists.txt b/source/tests/metacall_ducktype_test/CMakeLists.txt index 11eed7096..d092bc229 100644 --- a/source/tests/metacall_ducktype_test/CMakeLists.txt +++ b/source/tests/metacall_ducktype_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_duplicated_handle_test/CMakeLists.txt b/source/tests/metacall_duplicated_handle_test/CMakeLists.txt index 12424e225..977c38726 100644 --- a/source/tests/metacall_duplicated_handle_test/CMakeLists.txt +++ b/source/tests/metacall_duplicated_handle_test/CMakeLists.txt @@ -114,7 +114,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_duplicated_symbols_test/CMakeLists.txt b/source/tests/metacall_duplicated_symbols_test/CMakeLists.txt index 3b17aa0ac..8ad6ff0c3 100644 --- a/source/tests/metacall_duplicated_symbols_test/CMakeLists.txt +++ b/source/tests/metacall_duplicated_symbols_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_dynlink_path_test/CMakeLists.txt b/source/tests/metacall_dynlink_path_test/CMakeLists.txt index 722d234a7..70537e13e 100644 --- a/source/tests/metacall_dynlink_path_test/CMakeLists.txt +++ b/source/tests/metacall_dynlink_path_test/CMakeLists.txt @@ -115,7 +115,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ext_test/CMakeLists.txt b/source/tests/metacall_ext_test/CMakeLists.txt index b80533149..c7df0805a 100644 --- a/source/tests/metacall_ext_test/CMakeLists.txt +++ b/source/tests/metacall_ext_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_file_fail_test/CMakeLists.txt b/source/tests/metacall_file_fail_test/CMakeLists.txt index 7e8d50072..fb4c65e7b 100644 --- a/source/tests/metacall_file_fail_test/CMakeLists.txt +++ b/source/tests/metacall_file_fail_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_file_glob_test/CMakeLists.txt b/source/tests/metacall_file_glob_test/CMakeLists.txt index ae886d214..b5479a0f3 100644 --- a/source/tests/metacall_file_glob_test/CMakeLists.txt +++ b/source/tests/metacall_file_glob_test/CMakeLists.txt @@ -123,7 +123,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_file_test/CMakeLists.txt b/source/tests/metacall_file_test/CMakeLists.txt index 5f1673554..7be85a2a6 100644 --- a/source/tests/metacall_file_test/CMakeLists.txt +++ b/source/tests/metacall_file_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_fork_test/CMakeLists.txt b/source/tests/metacall_fork_test/CMakeLists.txt index 0c526d744..47d389592 100644 --- a/source/tests/metacall_fork_test/CMakeLists.txt +++ b/source/tests/metacall_fork_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_function_test/CMakeLists.txt b/source/tests/metacall_function_test/CMakeLists.txt index fbe8d14ea..2584da52b 100644 --- a/source/tests/metacall_function_test/CMakeLists.txt +++ b/source/tests/metacall_function_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_handle_export_test/CMakeLists.txt b/source/tests/metacall_handle_export_test/CMakeLists.txt index 7320e8e92..762cb174b 100644 --- a/source/tests/metacall_handle_export_test/CMakeLists.txt +++ b/source/tests/metacall_handle_export_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_handle_get_test/CMakeLists.txt b/source/tests/metacall_handle_get_test/CMakeLists.txt index 7a6576f36..73178da78 100644 --- a/source/tests/metacall_handle_get_test/CMakeLists.txt +++ b/source/tests/metacall_handle_get_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_init_fini_test/CMakeLists.txt b/source/tests/metacall_init_fini_test/CMakeLists.txt index 4b75590d1..bb1783bf3 100644 --- a/source/tests/metacall_init_fini_test/CMakeLists.txt +++ b/source/tests/metacall_init_fini_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_initialize_destroy_multiple_node_test/CMakeLists.txt b/source/tests/metacall_initialize_destroy_multiple_node_test/CMakeLists.txt index 65a685801..3d0c2ffde 100644 --- a/source/tests/metacall_initialize_destroy_multiple_node_test/CMakeLists.txt +++ b/source/tests/metacall_initialize_destroy_multiple_node_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_initialize_destroy_multiple_test/CMakeLists.txt b/source/tests/metacall_initialize_destroy_multiple_test/CMakeLists.txt index 9b19bbb70..2de694d0a 100644 --- a/source/tests/metacall_initialize_destroy_multiple_test/CMakeLists.txt +++ b/source/tests/metacall_initialize_destroy_multiple_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_initialize_ex_test/CMakeLists.txt b/source/tests/metacall_initialize_ex_test/CMakeLists.txt index 3aa9967e4..94332f3b4 100644 --- a/source/tests/metacall_initialize_ex_test/CMakeLists.txt +++ b/source/tests/metacall_initialize_ex_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_initialize_test/CMakeLists.txt b/source/tests/metacall_initialize_test/CMakeLists.txt index fb1b6abfb..f8b5b901a 100644 --- a/source/tests/metacall_initialize_test/CMakeLists.txt +++ b/source/tests/metacall_initialize_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_inspect_test/CMakeLists.txt b/source/tests/metacall_inspect_test/CMakeLists.txt index 3deb9cd29..ff5eaf740 100644 --- a/source/tests/metacall_inspect_test/CMakeLists.txt +++ b/source/tests/metacall_inspect_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_integration_test/CMakeLists.txt b/source/tests/metacall_integration_test/CMakeLists.txt index 7314bdebd..55b69ede2 100644 --- a/source/tests/metacall_integration_test/CMakeLists.txt +++ b/source/tests/metacall_integration_test/CMakeLists.txt @@ -117,7 +117,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_invalid_loader_test/CMakeLists.txt b/source/tests/metacall_invalid_loader_test/CMakeLists.txt index d3d16ec7a..8186d9362 100644 --- a/source/tests/metacall_invalid_loader_test/CMakeLists.txt +++ b/source/tests/metacall_invalid_loader_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_java_test/CMakeLists.txt b/source/tests/metacall_java_test/CMakeLists.txt index b1e2810fa..d9000eeb6 100644 --- a/source/tests/metacall_java_test/CMakeLists.txt +++ b/source/tests/metacall_java_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_julia_test/CMakeLists.txt b/source/tests/metacall_julia_test/CMakeLists.txt index c5f59d1e9..32dc65a6d 100644 --- a/source/tests/metacall_julia_test/CMakeLists.txt +++ b/source/tests/metacall_julia_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_library_path_without_env_vars_test/CMakeLists.txt b/source/tests/metacall_library_path_without_env_vars_test/CMakeLists.txt index 552b2ecc2..e38ecba46 100644 --- a/source/tests/metacall_library_path_without_env_vars_test/CMakeLists.txt +++ b/source/tests/metacall_library_path_without_env_vars_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_llvm_test/CMakeLists.txt b/source/tests/metacall_llvm_test/CMakeLists.txt index 31b0c3d35..76f79b68c 100644 --- a/source/tests/metacall_llvm_test/CMakeLists.txt +++ b/source/tests/metacall_llvm_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_configuration_fail_test/CMakeLists.txt b/source/tests/metacall_load_configuration_fail_test/CMakeLists.txt index 9d3f8e8ab..3a6293c6d 100644 --- a/source/tests/metacall_load_configuration_fail_test/CMakeLists.txt +++ b/source/tests/metacall_load_configuration_fail_test/CMakeLists.txt @@ -114,7 +114,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_configuration_node_python_test/CMakeLists.txt b/source/tests/metacall_load_configuration_node_python_test/CMakeLists.txt index 86917f395..f38f63ffb 100644 --- a/source/tests/metacall_load_configuration_node_python_test/CMakeLists.txt +++ b/source/tests/metacall_load_configuration_node_python_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_configuration_python_node_test/CMakeLists.txt b/source/tests/metacall_load_configuration_python_node_test/CMakeLists.txt index b7588a561..5d1c09042 100644 --- a/source/tests/metacall_load_configuration_python_node_test/CMakeLists.txt +++ b/source/tests/metacall_load_configuration_python_node_test/CMakeLists.txt @@ -116,7 +116,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_configuration_relative_test/CMakeLists.txt b/source/tests/metacall_load_configuration_relative_test/CMakeLists.txt index 90d3754bc..4cb9cfb73 100644 --- a/source/tests/metacall_load_configuration_relative_test/CMakeLists.txt +++ b/source/tests/metacall_load_configuration_relative_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_configuration_test/CMakeLists.txt b/source/tests/metacall_load_configuration_test/CMakeLists.txt index 04dca70c3..52f0a339f 100644 --- a/source/tests/metacall_load_configuration_test/CMakeLists.txt +++ b/source/tests/metacall_load_configuration_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_memory_empty_test/CMakeLists.txt b/source/tests/metacall_load_memory_empty_test/CMakeLists.txt index 719056eae..18371653f 100644 --- a/source/tests/metacall_load_memory_empty_test/CMakeLists.txt +++ b/source/tests/metacall_load_memory_empty_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_load_memory_test/CMakeLists.txt b/source/tests/metacall_load_memory_test/CMakeLists.txt index 014b7823f..7e45abf25 100644 --- a/source/tests/metacall_load_memory_test/CMakeLists.txt +++ b/source/tests/metacall_load_memory_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_logs_test/CMakeLists.txt b/source/tests/metacall_logs_test/CMakeLists.txt index 514da4c48..35386f0f7 100644 --- a/source/tests/metacall_logs_test/CMakeLists.txt +++ b/source/tests/metacall_logs_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_lua_test/CMakeLists.txt b/source/tests/metacall_lua_test/CMakeLists.txt index 164aeeb3c..b9b6a62c2 100644 --- a/source/tests/metacall_lua_test/CMakeLists.txt +++ b/source/tests/metacall_lua_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_map_await_test/CMakeLists.txt b/source/tests/metacall_map_await_test/CMakeLists.txt index 7cb62f098..b36cdee47 100644 --- a/source/tests/metacall_map_await_test/CMakeLists.txt +++ b/source/tests/metacall_map_await_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_map_test/CMakeLists.txt b/source/tests/metacall_map_test/CMakeLists.txt index ffe8d92c5..6022a8abd 100644 --- a/source/tests/metacall_map_test/CMakeLists.txt +++ b/source/tests/metacall_map_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_async_multiple_test/CMakeLists.txt b/source/tests/metacall_node_async_multiple_test/CMakeLists.txt index 2e5f9a135..fe9cea8ae 100644 --- a/source/tests/metacall_node_async_multiple_test/CMakeLists.txt +++ b/source/tests/metacall_node_async_multiple_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_async_resources_test/CMakeLists.txt b/source/tests/metacall_node_async_resources_test/CMakeLists.txt index 6fafa70d2..a3edb0a50 100644 --- a/source/tests/metacall_node_async_resources_test/CMakeLists.txt +++ b/source/tests/metacall_node_async_resources_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_async_test/CMakeLists.txt b/source/tests/metacall_node_async_test/CMakeLists.txt index d6a4050aa..3a29a55a4 100644 --- a/source/tests/metacall_node_async_test/CMakeLists.txt +++ b/source/tests/metacall_node_async_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_await_chain_test/CMakeLists.txt b/source/tests/metacall_node_await_chain_test/CMakeLists.txt index 8b15b75da..2b34facf9 100644 --- a/source/tests/metacall_node_await_chain_test/CMakeLists.txt +++ b/source/tests/metacall_node_await_chain_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_call_test/CMakeLists.txt b/source/tests/metacall_node_call_test/CMakeLists.txt index f0ac1da58..361544791 100644 --- a/source/tests/metacall_node_call_test/CMakeLists.txt +++ b/source/tests/metacall_node_call_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_callback_test/CMakeLists.txt b/source/tests/metacall_node_callback_test/CMakeLists.txt index 1249cc38e..2fa56024b 100644 --- a/source/tests/metacall_node_callback_test/CMakeLists.txt +++ b/source/tests/metacall_node_callback_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_clear_mem_test/CMakeLists.txt b/source/tests/metacall_node_clear_mem_test/CMakeLists.txt index c91655dc4..249b9066b 100644 --- a/source/tests/metacall_node_clear_mem_test/CMakeLists.txt +++ b/source/tests/metacall_node_clear_mem_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_default_export_test/CMakeLists.txt b/source/tests/metacall_node_default_export_test/CMakeLists.txt index 93468e1ad..56d39f320 100644 --- a/source/tests/metacall_node_default_export_test/CMakeLists.txt +++ b/source/tests/metacall_node_default_export_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_event_loop_signal_test/CMakeLists.txt b/source/tests/metacall_node_event_loop_signal_test/CMakeLists.txt index 7c2922950..dbb6410c1 100644 --- a/source/tests/metacall_node_event_loop_signal_test/CMakeLists.txt +++ b/source/tests/metacall_node_event_loop_signal_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_event_loop_test/CMakeLists.txt b/source/tests/metacall_node_event_loop_test/CMakeLists.txt index a0d1ae8ce..805dd2a9b 100644 --- a/source/tests/metacall_node_event_loop_test/CMakeLists.txt +++ b/source/tests/metacall_node_event_loop_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_exception_test/CMakeLists.txt b/source/tests/metacall_node_exception_test/CMakeLists.txt index f2a47f44e..707e52942 100644 --- a/source/tests/metacall_node_exception_test/CMakeLists.txt +++ b/source/tests/metacall_node_exception_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_extension_test/CMakeLists.txt b/source/tests/metacall_node_extension_test/CMakeLists.txt index 538385f34..1aac1018e 100644 --- a/source/tests/metacall_node_extension_test/CMakeLists.txt +++ b/source/tests/metacall_node_extension_test/CMakeLists.txt @@ -114,7 +114,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_extension_test/node_extension_test/CMakeLists.txt b/source/tests/metacall_node_extension_test/node_extension_test/CMakeLists.txt index 9cbd47bc1..1efbefcc0 100644 --- a/source/tests/metacall_node_extension_test/node_extension_test/CMakeLists.txt +++ b/source/tests/metacall_node_extension_test/node_extension_test/CMakeLists.txt @@ -173,7 +173,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE $<$:/IGNORE:4199> $<$:/DELAYLOAD:${NodeJS_LIBRARY_NAME}> diff --git a/source/tests/metacall_node_fail_env_var_test/CMakeLists.txt b/source/tests/metacall_node_fail_env_var_test/CMakeLists.txt index 9125c4a7b..e8310a78c 100644 --- a/source/tests/metacall_node_fail_env_var_test/CMakeLists.txt +++ b/source/tests/metacall_node_fail_env_var_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_fail_load_leak_test/CMakeLists.txt b/source/tests/metacall_node_fail_load_leak_test/CMakeLists.txt index 0477424f8..aaed9e522 100644 --- a/source/tests/metacall_node_fail_load_leak_test/CMakeLists.txt +++ b/source/tests/metacall_node_fail_load_leak_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_fail_test/CMakeLists.txt b/source/tests/metacall_node_fail_test/CMakeLists.txt index fe06183eb..62fb239d4 100644 --- a/source/tests/metacall_node_fail_test/CMakeLists.txt +++ b/source/tests/metacall_node_fail_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_inline_test/CMakeLists.txt b/source/tests/metacall_node_inline_test/CMakeLists.txt index 9f7829362..af8f0c8b5 100644 --- a/source/tests/metacall_node_inline_test/CMakeLists.txt +++ b/source/tests/metacall_node_inline_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_multithread_deadlock_test/CMakeLists.txt b/source/tests/metacall_node_multithread_deadlock_test/CMakeLists.txt index c7c06a689..6f3f91f47 100644 --- a/source/tests/metacall_node_multithread_deadlock_test/CMakeLists.txt +++ b/source/tests/metacall_node_multithread_deadlock_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_native_code_test/CMakeLists.txt b/source/tests/metacall_node_native_code_test/CMakeLists.txt index 59f982c4c..31b61509e 100644 --- a/source/tests/metacall_node_native_code_test/CMakeLists.txt +++ b/source/tests/metacall_node_native_code_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_port_await_test/CMakeLists.txt b/source/tests/metacall_node_port_await_test/CMakeLists.txt index 1b87b2f23..c72587ba4 100644 --- a/source/tests/metacall_node_port_await_test/CMakeLists.txt +++ b/source/tests/metacall_node_port_await_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_port_c_lib_test/CMakeLists.txt b/source/tests/metacall_node_port_c_lib_test/CMakeLists.txt index 6fb0c363a..3c13cf6be 100644 --- a/source/tests/metacall_node_port_c_lib_test/CMakeLists.txt +++ b/source/tests/metacall_node_port_c_lib_test/CMakeLists.txt @@ -128,7 +128,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_port_rs_test/CMakeLists.txt b/source/tests/metacall_node_port_rs_test/CMakeLists.txt index 081c44abc..1f4f82043 100644 --- a/source/tests/metacall_node_port_rs_test/CMakeLists.txt +++ b/source/tests/metacall_node_port_rs_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_port_test/CMakeLists.txt b/source/tests/metacall_node_port_test/CMakeLists.txt index 2d83ab674..86dadd93d 100644 --- a/source/tests/metacall_node_port_test/CMakeLists.txt +++ b/source/tests/metacall_node_port_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_async_after_destroy_test/CMakeLists.txt b/source/tests/metacall_node_python_async_after_destroy_test/CMakeLists.txt index 435ed2445..6388179f7 100644 --- a/source/tests/metacall_node_python_async_after_destroy_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_async_after_destroy_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_await_extended_test/CMakeLists.txt b/source/tests/metacall_node_python_await_extended_test/CMakeLists.txt index 6c88f35e3..e7576cb18 100644 --- a/source/tests/metacall_node_python_await_extended_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_await_extended_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_await_test/CMakeLists.txt b/source/tests/metacall_node_python_await_test/CMakeLists.txt index 09f86f6ba..2edadbea7 100644 --- a/source/tests/metacall_node_python_await_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_await_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_deadlock_test/CMakeLists.txt b/source/tests/metacall_node_python_deadlock_test/CMakeLists.txt index 0e896b1dc..4e1fb4b71 100644 --- a/source/tests/metacall_node_python_deadlock_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_deadlock_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_exception_test/CMakeLists.txt b/source/tests/metacall_node_python_exception_test/CMakeLists.txt index 49aee2178..f759a0b30 100644 --- a/source/tests/metacall_node_python_exception_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_exception_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_port_mock_test/CMakeLists.txt b/source/tests/metacall_node_python_port_mock_test/CMakeLists.txt index 5cee029fe..105e401fc 100644 --- a/source/tests/metacall_node_python_port_mock_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_port_mock_test/CMakeLists.txt @@ -116,7 +116,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_port_ruby_test/CMakeLists.txt b/source/tests/metacall_node_python_port_ruby_test/CMakeLists.txt index faa5e03e8..06e1e46bb 100644 --- a/source/tests/metacall_node_python_port_ruby_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_port_ruby_test/CMakeLists.txt @@ -116,7 +116,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_python_ruby_test/CMakeLists.txt b/source/tests/metacall_node_python_ruby_test/CMakeLists.txt index dbcd8c316..a9756c091 100644 --- a/source/tests/metacall_node_python_ruby_test/CMakeLists.txt +++ b/source/tests/metacall_node_python_ruby_test/CMakeLists.txt @@ -122,7 +122,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_reentrant_test/CMakeLists.txt b/source/tests/metacall_node_reentrant_test/CMakeLists.txt index 27cdea516..a4ec68f52 100644 --- a/source/tests/metacall_node_reentrant_test/CMakeLists.txt +++ b/source/tests/metacall_node_reentrant_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_signal_handler_test/CMakeLists.txt b/source/tests/metacall_node_signal_handler_test/CMakeLists.txt index 312d29679..16e7cbd5e 100644 --- a/source/tests/metacall_node_signal_handler_test/CMakeLists.txt +++ b/source/tests/metacall_node_signal_handler_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_test/CMakeLists.txt b/source/tests/metacall_node_test/CMakeLists.txt index 3c311060a..238ccbd4c 100644 --- a/source/tests/metacall_node_test/CMakeLists.txt +++ b/source/tests/metacall_node_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_node_typescript_test/CMakeLists.txt b/source/tests/metacall_node_typescript_test/CMakeLists.txt index 4a80ab646..f0858d246 100644 --- a/source/tests/metacall_node_typescript_test/CMakeLists.txt +++ b/source/tests/metacall_node_typescript_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_plugin_extension_destroy_order_test/CMakeLists.txt b/source/tests/metacall_plugin_extension_destroy_order_test/CMakeLists.txt index 29f56547c..f11064599 100644 --- a/source/tests/metacall_plugin_extension_destroy_order_test/CMakeLists.txt +++ b/source/tests/metacall_plugin_extension_destroy_order_test/CMakeLists.txt @@ -122,7 +122,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_plugin_extension_invalid_path_test/CMakeLists.txt b/source/tests/metacall_plugin_extension_invalid_path_test/CMakeLists.txt index a4328a9cc..fc0d79660 100644 --- a/source/tests/metacall_plugin_extension_invalid_path_test/CMakeLists.txt +++ b/source/tests/metacall_plugin_extension_invalid_path_test/CMakeLists.txt @@ -115,7 +115,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_plugin_extension_local_test/CMakeLists.txt b/source/tests/metacall_plugin_extension_local_test/CMakeLists.txt index 438ce9105..20f25e9fd 100644 --- a/source/tests/metacall_plugin_extension_local_test/CMakeLists.txt +++ b/source/tests/metacall_plugin_extension_local_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_plugin_extension_test/CMakeLists.txt b/source/tests/metacall_plugin_extension_test/CMakeLists.txt index 3b783b815..a6eead001 100644 --- a/source/tests/metacall_plugin_extension_test/CMakeLists.txt +++ b/source/tests/metacall_plugin_extension_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_async_test/CMakeLists.txt b/source/tests/metacall_python_async_test/CMakeLists.txt index 3438c0ff4..3acc0f211 100644 --- a/source/tests/metacall_python_async_test/CMakeLists.txt +++ b/source/tests/metacall_python_async_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_await_test/CMakeLists.txt b/source/tests/metacall_python_await_test/CMakeLists.txt index 9e77a645c..767eda765 100644 --- a/source/tests/metacall_python_await_test/CMakeLists.txt +++ b/source/tests/metacall_python_await_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_builtins_test/CMakeLists.txt b/source/tests/metacall_python_builtins_test/CMakeLists.txt index 8d99ccf6c..d9ca104c3 100644 --- a/source/tests/metacall_python_builtins_test/CMakeLists.txt +++ b/source/tests/metacall_python_builtins_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_callback_test/CMakeLists.txt b/source/tests/metacall_python_callback_test/CMakeLists.txt index 702009b82..4f7a4e1b3 100644 --- a/source/tests/metacall_python_callback_test/CMakeLists.txt +++ b/source/tests/metacall_python_callback_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_dict_test/CMakeLists.txt b/source/tests/metacall_python_dict_test/CMakeLists.txt index 0f08317ff..8cc1916d7 100644 --- a/source/tests/metacall_python_dict_test/CMakeLists.txt +++ b/source/tests/metacall_python_dict_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_exception_test/CMakeLists.txt b/source/tests/metacall_python_exception_test/CMakeLists.txt index 904d8a573..31109d355 100644 --- a/source/tests/metacall_python_exception_test/CMakeLists.txt +++ b/source/tests/metacall_python_exception_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_fail_test/CMakeLists.txt b/source/tests/metacall_python_fail_test/CMakeLists.txt index b8950664c..fdf0097ed 100644 --- a/source/tests/metacall_python_fail_test/CMakeLists.txt +++ b/source/tests/metacall_python_fail_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_gc_test/CMakeLists.txt b/source/tests/metacall_python_gc_test/CMakeLists.txt index 4155fec42..dea0f4ae2 100644 --- a/source/tests/metacall_python_gc_test/CMakeLists.txt +++ b/source/tests/metacall_python_gc_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_loader_port_test/CMakeLists.txt b/source/tests/metacall_python_loader_port_test/CMakeLists.txt index 63bcdad97..82bfb7529 100644 --- a/source/tests/metacall_python_loader_port_test/CMakeLists.txt +++ b/source/tests/metacall_python_loader_port_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_model_test/CMakeLists.txt b/source/tests/metacall_python_model_test/CMakeLists.txt index 86155738c..59494beac 100644 --- a/source/tests/metacall_python_model_test/CMakeLists.txt +++ b/source/tests/metacall_python_model_test/CMakeLists.txt @@ -122,7 +122,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_node_await_test/CMakeLists.txt b/source/tests/metacall_python_node_await_test/CMakeLists.txt index b4cf36b3c..9995c37e0 100644 --- a/source/tests/metacall_python_node_await_test/CMakeLists.txt +++ b/source/tests/metacall_python_node_await_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_object_class_test/CMakeLists.txt b/source/tests/metacall_python_object_class_test/CMakeLists.txt index 71dea28cf..475a515ca 100644 --- a/source/tests/metacall_python_object_class_test/CMakeLists.txt +++ b/source/tests/metacall_python_object_class_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_open_test/CMakeLists.txt b/source/tests/metacall_python_open_test/CMakeLists.txt index 8569b85cd..ce067050d 100644 --- a/source/tests/metacall_python_open_test/CMakeLists.txt +++ b/source/tests/metacall_python_open_test/CMakeLists.txt @@ -131,7 +131,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_pointer_test/CMakeLists.txt b/source/tests/metacall_python_pointer_test/CMakeLists.txt index 9c807909a..4beab7b92 100644 --- a/source/tests/metacall_python_pointer_test/CMakeLists.txt +++ b/source/tests/metacall_python_pointer_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_port_callback_test/CMakeLists.txt b/source/tests/metacall_python_port_callback_test/CMakeLists.txt index 6ba38e2c5..95ddf1ad7 100644 --- a/source/tests/metacall_python_port_callback_test/CMakeLists.txt +++ b/source/tests/metacall_python_port_callback_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_port_https_test/CMakeLists.txt b/source/tests/metacall_python_port_https_test/CMakeLists.txt index 961f0af9a..fa4127119 100644 --- a/source/tests/metacall_python_port_https_test/CMakeLists.txt +++ b/source/tests/metacall_python_port_https_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_port_import_test/CMakeLists.txt b/source/tests/metacall_python_port_import_test/CMakeLists.txt index 285dea5cc..8d1d94f1c 100644 --- a/source/tests/metacall_python_port_import_test/CMakeLists.txt +++ b/source/tests/metacall_python_port_import_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_port_pointer_test/CMakeLists.txt b/source/tests/metacall_python_port_pointer_test/CMakeLists.txt index 55188da8f..463a4e5b6 100644 --- a/source/tests/metacall_python_port_pointer_test/CMakeLists.txt +++ b/source/tests/metacall_python_port_pointer_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_port_test/CMakeLists.txt b/source/tests/metacall_python_port_test/CMakeLists.txt index 1caa130fa..431379d4a 100644 --- a/source/tests/metacall_python_port_test/CMakeLists.txt +++ b/source/tests/metacall_python_port_test/CMakeLists.txt @@ -113,7 +113,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_reentrant_test/CMakeLists.txt b/source/tests/metacall_python_reentrant_test/CMakeLists.txt index f196c4f9d..8f6a82e07 100644 --- a/source/tests/metacall_python_reentrant_test/CMakeLists.txt +++ b/source/tests/metacall_python_reentrant_test/CMakeLists.txt @@ -114,7 +114,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_relative_path_test/CMakeLists.txt b/source/tests/metacall_python_relative_path_test/CMakeLists.txt index e6ddb6028..2a5ad0ff8 100644 --- a/source/tests/metacall_python_relative_path_test/CMakeLists.txt +++ b/source/tests/metacall_python_relative_path_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_test/CMakeLists.txt b/source/tests/metacall_python_test/CMakeLists.txt index 77631a1fe..5fb1bec57 100644 --- a/source/tests/metacall_python_test/CMakeLists.txt +++ b/source/tests/metacall_python_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_varargs_test/CMakeLists.txt b/source/tests/metacall_python_varargs_test/CMakeLists.txt index 9143fc44e..bae80e62d 100644 --- a/source/tests/metacall_python_varargs_test/CMakeLists.txt +++ b/source/tests/metacall_python_varargs_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_without_env_vars_test/CMakeLists.txt b/source/tests/metacall_python_without_env_vars_test/CMakeLists.txt index 1a100f4ad..9e871cf89 100644 --- a/source/tests/metacall_python_without_env_vars_test/CMakeLists.txt +++ b/source/tests/metacall_python_without_env_vars_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_python_without_functions_test/CMakeLists.txt b/source/tests/metacall_python_without_functions_test/CMakeLists.txt index 540595104..a4f92966a 100644 --- a/source/tests/metacall_python_without_functions_test/CMakeLists.txt +++ b/source/tests/metacall_python_without_functions_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_reinitialize_test/CMakeLists.txt b/source/tests/metacall_reinitialize_test/CMakeLists.txt index f57b6b85f..73beda512 100644 --- a/source/tests/metacall_reinitialize_test/CMakeLists.txt +++ b/source/tests/metacall_reinitialize_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_reload_functions_test/CMakeLists.txt b/source/tests/metacall_reload_functions_test/CMakeLists.txt index 4474e902e..4398e0a2d 100644 --- a/source/tests/metacall_reload_functions_test/CMakeLists.txt +++ b/source/tests/metacall_reload_functions_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_return_monad_test/CMakeLists.txt b/source/tests/metacall_return_monad_test/CMakeLists.txt index 91874ed62..54f90028d 100644 --- a/source/tests/metacall_return_monad_test/CMakeLists.txt +++ b/source/tests/metacall_return_monad_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rpc_test/CMakeLists.txt b/source/tests/metacall_rpc_test/CMakeLists.txt index 8fef52d0f..091cd4196 100644 --- a/source/tests/metacall_rpc_test/CMakeLists.txt +++ b/source/tests/metacall_rpc_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ruby_fail_empty_test/CMakeLists.txt b/source/tests/metacall_ruby_fail_empty_test/CMakeLists.txt index 1fe56e79a..4503b7df1 100644 --- a/source/tests/metacall_ruby_fail_empty_test/CMakeLists.txt +++ b/source/tests/metacall_ruby_fail_empty_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ruby_fail_test/CMakeLists.txt b/source/tests/metacall_ruby_fail_test/CMakeLists.txt index 211d238b3..7211d396e 100644 --- a/source/tests/metacall_ruby_fail_test/CMakeLists.txt +++ b/source/tests/metacall_ruby_fail_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ruby_object_class_test/CMakeLists.txt b/source/tests/metacall_ruby_object_class_test/CMakeLists.txt index fc9e50765..50908e439 100644 --- a/source/tests/metacall_ruby_object_class_test/CMakeLists.txt +++ b/source/tests/metacall_ruby_object_class_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ruby_parser_integration_test/CMakeLists.txt b/source/tests/metacall_ruby_parser_integration_test/CMakeLists.txt index e933746a3..49a899ecf 100644 --- a/source/tests/metacall_ruby_parser_integration_test/CMakeLists.txt +++ b/source/tests/metacall_ruby_parser_integration_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ruby_rails_integration_test/CMakeLists.txt b/source/tests/metacall_ruby_rails_integration_test/CMakeLists.txt index 3f19f74b4..a2afac751 100644 --- a/source/tests/metacall_ruby_rails_integration_test/CMakeLists.txt +++ b/source/tests/metacall_ruby_rails_integration_test/CMakeLists.txt @@ -118,7 +118,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_ruby_test/CMakeLists.txt b/source/tests/metacall_ruby_test/CMakeLists.txt index 267af49c8..41d084aad 100644 --- a/source/tests/metacall_ruby_test/CMakeLists.txt +++ b/source/tests/metacall_ruby_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rust_class_test/CMakeLists.txt b/source/tests/metacall_rust_class_test/CMakeLists.txt index c968d3174..dd529756f 100644 --- a/source/tests/metacall_rust_class_test/CMakeLists.txt +++ b/source/tests/metacall_rust_class_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rust_load_from_mem_test/CMakeLists.txt b/source/tests/metacall_rust_load_from_mem_test/CMakeLists.txt index 46488ba4d..efcfafdcb 100644 --- a/source/tests/metacall_rust_load_from_mem_test/CMakeLists.txt +++ b/source/tests/metacall_rust_load_from_mem_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rust_load_from_package_class_test/CMakeLists.txt b/source/tests/metacall_rust_load_from_package_class_test/CMakeLists.txt index 757198c39..33b0b2909 100644 --- a/source/tests/metacall_rust_load_from_package_class_test/CMakeLists.txt +++ b/source/tests/metacall_rust_load_from_package_class_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rust_load_from_package_dep_test/CMakeLists.txt b/source/tests/metacall_rust_load_from_package_dep_test/CMakeLists.txt index 3b47f2f3e..3f9d02f86 100644 --- a/source/tests/metacall_rust_load_from_package_dep_test/CMakeLists.txt +++ b/source/tests/metacall_rust_load_from_package_dep_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rust_load_from_package_test/CMakeLists.txt b/source/tests/metacall_rust_load_from_package_test/CMakeLists.txt index c77fcfa35..e46e552dd 100644 --- a/source/tests/metacall_rust_load_from_package_test/CMakeLists.txt +++ b/source/tests/metacall_rust_load_from_package_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_rust_test/CMakeLists.txt b/source/tests/metacall_rust_test/CMakeLists.txt index 543fac1de..9b0cfc8b3 100644 --- a/source/tests/metacall_rust_test/CMakeLists.txt +++ b/source/tests/metacall_rust_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_sandbox_plugin_test/CMakeLists.txt b/source/tests/metacall_sandbox_plugin_test/CMakeLists.txt index 351a271b7..67732e310 100644 --- a/source/tests/metacall_sandbox_plugin_test/CMakeLists.txt +++ b/source/tests/metacall_sandbox_plugin_test/CMakeLists.txt @@ -127,7 +127,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_test/CMakeLists.txt b/source/tests/metacall_test/CMakeLists.txt index 932f43008..4d75fe9b7 100644 --- a/source/tests/metacall_test/CMakeLists.txt +++ b/source/tests/metacall_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_call_map_test/CMakeLists.txt b/source/tests/metacall_typescript_call_map_test/CMakeLists.txt index 55f940a6f..46f491804 100644 --- a/source/tests/metacall_typescript_call_map_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_call_map_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_jsx_default_test/CMakeLists.txt b/source/tests/metacall_typescript_jsx_default_test/CMakeLists.txt index 1f88419a8..a41409a5b 100644 --- a/source/tests/metacall_typescript_jsx_default_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_jsx_default_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_node_test/CMakeLists.txt b/source/tests/metacall_typescript_node_test/CMakeLists.txt index ba02a30ff..95954f202 100644 --- a/source/tests/metacall_typescript_node_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_node_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_require_test/CMakeLists.txt b/source/tests/metacall_typescript_require_test/CMakeLists.txt index 7ac9c1033..2e1e327bd 100644 --- a/source/tests/metacall_typescript_require_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_require_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_test/CMakeLists.txt b/source/tests/metacall_typescript_test/CMakeLists.txt index 92ac58a70..1ad8d87d3 100644 --- a/source/tests/metacall_typescript_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_tsx_loop_fail_test/CMakeLists.txt b/source/tests/metacall_typescript_tsx_loop_fail_test/CMakeLists.txt index f88d202b5..59789903b 100644 --- a/source/tests/metacall_typescript_tsx_loop_fail_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_tsx_loop_fail_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_typescript_tsx_test/CMakeLists.txt b/source/tests/metacall_typescript_tsx_test/CMakeLists.txt index 2f1c5273f..b6732071c 100644 --- a/source/tests/metacall_typescript_tsx_test/CMakeLists.txt +++ b/source/tests/metacall_typescript_tsx_test/CMakeLists.txt @@ -111,7 +111,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_version_test/CMakeLists.txt b/source/tests/metacall_version_test/CMakeLists.txt index 1b89dd1e8..8b3465541 100644 --- a/source/tests/metacall_version_test/CMakeLists.txt +++ b/source/tests/metacall_version_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_wasm_python_port_test/CMakeLists.txt b/source/tests/metacall_wasm_python_port_test/CMakeLists.txt index e179a04e1..09c1efe10 100644 --- a/source/tests/metacall_wasm_python_port_test/CMakeLists.txt +++ b/source/tests/metacall_wasm_python_port_test/CMakeLists.txt @@ -112,7 +112,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/metacall_wasm_test/CMakeLists.txt b/source/tests/metacall_wasm_test/CMakeLists.txt index 8a928bef8..5aeb8ca0a 100644 --- a/source/tests/metacall_wasm_test/CMakeLists.txt +++ b/source/tests/metacall_wasm_test/CMakeLists.txt @@ -110,7 +110,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/portability_path_test/CMakeLists.txt b/source/tests/portability_path_test/CMakeLists.txt index ea98857af..37274fd9e 100644 --- a/source/tests/portability_path_test/CMakeLists.txt +++ b/source/tests/portability_path_test/CMakeLists.txt @@ -105,7 +105,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/preprocessor_test/CMakeLists.txt b/source/tests/preprocessor_test/CMakeLists.txt index 17efabee8..68470eab2 100644 --- a/source/tests/preprocessor_test/CMakeLists.txt +++ b/source/tests/preprocessor_test/CMakeLists.txt @@ -106,7 +106,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/rb_loader_parser_test/CMakeLists.txt b/source/tests/rb_loader_parser_test/CMakeLists.txt index 30cb37c5a..4e6162aa5 100644 --- a/source/tests/rb_loader_parser_test/CMakeLists.txt +++ b/source/tests/rb_loader_parser_test/CMakeLists.txt @@ -125,7 +125,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/reflect_function_test/CMakeLists.txt b/source/tests/reflect_function_test/CMakeLists.txt index 202dca6ac..9beb3781a 100644 --- a/source/tests/reflect_function_test/CMakeLists.txt +++ b/source/tests/reflect_function_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/reflect_metadata_test/CMakeLists.txt b/source/tests/reflect_metadata_test/CMakeLists.txt index 07291ac50..37e635bc6 100644 --- a/source/tests/reflect_metadata_test/CMakeLists.txt +++ b/source/tests/reflect_metadata_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/reflect_object_class_test/CMakeLists.txt b/source/tests/reflect_object_class_test/CMakeLists.txt index 14d331f17..77f837183 100644 --- a/source/tests/reflect_object_class_test/CMakeLists.txt +++ b/source/tests/reflect_object_class_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/reflect_scope_test/CMakeLists.txt b/source/tests/reflect_scope_test/CMakeLists.txt index dfb712094..0a4bd718c 100644 --- a/source/tests/reflect_scope_test/CMakeLists.txt +++ b/source/tests/reflect_scope_test/CMakeLists.txt @@ -119,7 +119,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/reflect_value_cast_test/CMakeLists.txt b/source/tests/reflect_value_cast_test/CMakeLists.txt index 616715e7f..46e51f3ae 100644 --- a/source/tests/reflect_value_cast_test/CMakeLists.txt +++ b/source/tests/reflect_value_cast_test/CMakeLists.txt @@ -125,7 +125,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/tests/serial_test/CMakeLists.txt b/source/tests/serial_test/CMakeLists.txt index eb56ea1e1..8b32df06a 100644 --- a/source/tests/serial_test/CMakeLists.txt +++ b/source/tests/serial_test/CMakeLists.txt @@ -124,7 +124,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE ${DEFAULT_LINKER_OPTIONS} ) diff --git a/source/threading/CMakeLists.txt b/source/threading/CMakeLists.txt index 7486dced9..830545d85 100644 --- a/source/threading/CMakeLists.txt +++ b/source/threading/CMakeLists.txt @@ -178,7 +178,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC diff --git a/source/version/CMakeLists.txt b/source/version/CMakeLists.txt index 235dd1e3a..ff0bed815 100644 --- a/source/version/CMakeLists.txt +++ b/source/version/CMakeLists.txt @@ -151,7 +151,7 @@ target_compile_options(${target} # Linker options # -add_link_options(${target} +target_link_options(${target} PRIVATE PUBLIC From 0a19cc732b67d686752b5fd49e74f1daffa6b39c Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 23:37:46 +0100 Subject: [PATCH 49/66] Remove googletest. --- tools/metacall-environment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/metacall-environment.sh b/tools/metacall-environment.sh index 64982d14e..4df23f6ad 100755 --- a/tools/metacall-environment.sh +++ b/tools/metacall-environment.sh @@ -110,7 +110,7 @@ sub_base(){ $SUDO_CMD apk add --no-cache g++ make git cmake gtest-dev wget gnupg ca-certificates fi elif [ "${OPERATIVE_SYSTEM}" = "Darwin" ]; then - brew install llvm cmake git googletest wget gnupg ca-certificates + brew install llvm cmake git wget gnupg ca-certificates # googletest fi } From 30ac8a9b9f54bbbc80226ddb2b1c5c73e9a87fa1 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 23:43:50 +0100 Subject: [PATCH 50/66] Add debug info for build. --- tools/metacall-build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/metacall-build.sh b/tools/metacall-build.sh index d2074c1af..196bdfb64 100755 --- a/tools/metacall-build.sh +++ b/tools/metacall-build.sh @@ -73,6 +73,9 @@ sub_build() { # Build the project make -j$(getconf _NPROCESSORS_ONLN) + # Debug the make output + ls -la + # Tests (coverage needs to run the tests) if [ $BUILD_TESTS = 1 ] || [ $BUILD_BENCHMARKS=1 ] || [ $BUILD_COVERAGE = 1 ]; then ctest -j$(getconf _NPROCESSORS_ONLN) --timeout 5400 --output-on-failure --test-output-size-failed 3221000000 -C $BUILD_TYPE From a36aa9166d3d4ef94433546f8f63451c2dcad007 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Tue, 25 Feb 2025 23:59:11 +0100 Subject: [PATCH 51/66] Remove gtest. --- tools/metacall-environment.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/metacall-environment.sh b/tools/metacall-environment.sh index 4df23f6ad..92cbd780f 100755 --- a/tools/metacall-environment.sh +++ b/tools/metacall-environment.sh @@ -104,13 +104,13 @@ sub_base(){ if [ "${OPERATIVE_SYSTEM}" = "Linux" ]; then if [ "${LINUX_DISTRO}" = "debian" ] || [ "${LINUX_DISTRO}" = "ubuntu" ]; then $SUDO_CMD apt-get update - $SUDO_CMD apt-get $APT_CACHE_CMD install -y --no-install-recommends build-essential git cmake libgtest-dev wget apt-utils apt-transport-https gnupg dirmngr ca-certificates + $SUDO_CMD apt-get $APT_CACHE_CMD install -y --no-install-recommends build-essential git cmake wget apt-utils apt-transport-https gnupg dirmngr ca-certificates elif [ "${LINUX_DISTRO}" = "alpine" ]; then $SUDO_CMD apk update - $SUDO_CMD apk add --no-cache g++ make git cmake gtest-dev wget gnupg ca-certificates + $SUDO_CMD apk add --no-cache g++ make git cmake wget gnupg ca-certificates fi elif [ "${OPERATIVE_SYSTEM}" = "Darwin" ]; then - brew install llvm cmake git wget gnupg ca-certificates # googletest + brew install llvm cmake git wget gnupg ca-certificates fi } From 3f8ecf50c78c894e1f72585b763e66ebdc6237a8 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 00:07:17 +0100 Subject: [PATCH 52/66] Add more debug macos. --- tools/metacall-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/metacall-build.sh b/tools/metacall-build.sh index 196bdfb64..4796146df 100755 --- a/tools/metacall-build.sh +++ b/tools/metacall-build.sh @@ -75,6 +75,7 @@ sub_build() { # Debug the make output ls -la + find . -name "*funchook*" # Tests (coverage needs to run the tests) if [ $BUILD_TESTS = 1 ] || [ $BUILD_BENCHMARKS=1 ] || [ $BUILD_COVERAGE = 1 ]; then From fbb2aa7d202b7ab4d2343e5978cefffe208ffa46 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 00:20:14 +0100 Subject: [PATCH 53/66] Solve issues with libfunchook. --- source/detours/funchook_detour/CMakeLists.txt | 13 ++++++++++--- tools/metacall-build.sh | 4 ---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index afd225e3d..d50fcb4ae 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -33,12 +33,11 @@ if(WIN32) set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/funchook.${FUNCHOOK_LIBRARY_INSTALL_SUFFIX}") else() set(FUNCHOOK_BUILD_TARGET "install") - set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/libfunchook.${FUNCHOOK_LIBRARY_SUFFIX}") + set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/lib/libfunchook.${FUNCHOOK_LIBRARY_SUFFIX}") set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_LIBRARY_DIR}") endif() set(FUNCHOOK_INSTALL_DIR "${PROJECT_OUTPUT_DIR}") -set(FUNCHOOK_CMAKE_INSTALL_BINDIR "${PROJECT_OUTPUT_DIR}") set(FUNCHOOK_INCLUDE_DIR "${FUNCHOOK_SOURCE_DIR}/include") ExternalProject_Add(${target_depends} @@ -46,7 +45,15 @@ ExternalProject_Add(${target_depends} SOURCE_DIR ${FUNCHOOK_SOURCE_DIR} INSTALL_DIR ${FUNCHOOK_INSTALL_DIR} DOWNLOAD_COMMAND "${GIT_EXECUTABLE}" clone --single-branch --branch v${FUNCHOOK_VERSION} --recursive https://github.com/kubo/funchook.git "${FUNCHOOK_SOURCE_DIR}" - CONFIGURE_COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_PARALLEL_LEVEL=1 -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON -DCMAKE_INSTALL_PREFIX=${FUNCHOOK_INSTALL_DIR} -DCMAKE_INSTALL_BINDIR=${FUNCHOOK_CMAKE_INSTALL_BINDIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DFUNCHOOK_BUILD_SHARED=ON -DFUNCHOOK_BUILD_TESTS=OFF -DFUNCHOOK_BUILD_STATIC=OFF . + CMAKE_ARGS + -G "${CMAKE_GENERATOR}" + -DCMAKE_BUILD_PARALLEL_LEVEL=1 + -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON + -DCMAKE_INSTALL_PREFIX=${FUNCHOOK_INSTALL_DIR} + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DFUNCHOOK_BUILD_SHARED=ON + -DFUNCHOOK_BUILD_TESTS=OFF + -DFUNCHOOK_BUILD_STATIC=OFF BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --target ${FUNCHOOK_BUILD_TARGET} UPDATE_COMMAND "" BUILD_IN_SOURCE ON diff --git a/tools/metacall-build.sh b/tools/metacall-build.sh index 4796146df..d2074c1af 100755 --- a/tools/metacall-build.sh +++ b/tools/metacall-build.sh @@ -73,10 +73,6 @@ sub_build() { # Build the project make -j$(getconf _NPROCESSORS_ONLN) - # Debug the make output - ls -la - find . -name "*funchook*" - # Tests (coverage needs to run the tests) if [ $BUILD_TESTS = 1 ] || [ $BUILD_BENCHMARKS=1 ] || [ $BUILD_COVERAGE = 1 ]; then ctest -j$(getconf _NPROCESSORS_ONLN) --timeout 5400 --output-on-failure --test-output-size-failed 3221000000 -C $BUILD_TYPE From 04220ad5b038da8263aa4015598363daa83213eb Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 00:34:39 +0100 Subject: [PATCH 54/66] Solve more issues funchook. --- source/detours/funchook_detour/CMakeLists.txt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index d50fcb4ae..7811dce8b 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -45,15 +45,7 @@ ExternalProject_Add(${target_depends} SOURCE_DIR ${FUNCHOOK_SOURCE_DIR} INSTALL_DIR ${FUNCHOOK_INSTALL_DIR} DOWNLOAD_COMMAND "${GIT_EXECUTABLE}" clone --single-branch --branch v${FUNCHOOK_VERSION} --recursive https://github.com/kubo/funchook.git "${FUNCHOOK_SOURCE_DIR}" - CMAKE_ARGS - -G "${CMAKE_GENERATOR}" - -DCMAKE_BUILD_PARALLEL_LEVEL=1 - -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON - -DCMAKE_INSTALL_PREFIX=${FUNCHOOK_INSTALL_DIR} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DFUNCHOOK_BUILD_SHARED=ON - -DFUNCHOOK_BUILD_TESTS=OFF - -DFUNCHOOK_BUILD_STATIC=OFF + CONFIGURE_COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_PARALLEL_LEVEL=1 -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON -DCMAKE_INSTALL_PREFIX=${FUNCHOOK_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DFUNCHOOK_BUILD_SHARED=ON -DFUNCHOOK_BUILD_TESTS=OFF -DFUNCHOOK_BUILD_STATIC=OFF . BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --target ${FUNCHOOK_BUILD_TARGET} UPDATE_COMMAND "" BUILD_IN_SOURCE ON From 837033273b640d6771389171c90b120e0878576b Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 00:49:02 +0100 Subject: [PATCH 55/66] Solving issues funchook. --- source/detours/funchook_detour/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index 7811dce8b..bf9ba843d 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -33,7 +33,7 @@ if(WIN32) set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/funchook.${FUNCHOOK_LIBRARY_INSTALL_SUFFIX}") else() set(FUNCHOOK_BUILD_TARGET "install") - set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/lib/libfunchook.${FUNCHOOK_LIBRARY_SUFFIX}") + set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/libfunchook.${FUNCHOOK_LIBRARY_SUFFIX}") set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_LIBRARY_DIR}") endif() @@ -43,10 +43,10 @@ set(FUNCHOOK_INCLUDE_DIR "${FUNCHOOK_SOURCE_DIR}/include") ExternalProject_Add(${target_depends} PREFIX funchook SOURCE_DIR ${FUNCHOOK_SOURCE_DIR} - INSTALL_DIR ${FUNCHOOK_INSTALL_DIR} + # INSTALL_DIR ${FUNCHOOK_INSTALL_DIR} DOWNLOAD_COMMAND "${GIT_EXECUTABLE}" clone --single-branch --branch v${FUNCHOOK_VERSION} --recursive https://github.com/kubo/funchook.git "${FUNCHOOK_SOURCE_DIR}" CONFIGURE_COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_PARALLEL_LEVEL=1 -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON -DCMAKE_INSTALL_PREFIX=${FUNCHOOK_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DFUNCHOOK_BUILD_SHARED=ON -DFUNCHOOK_BUILD_TESTS=OFF -DFUNCHOOK_BUILD_STATIC=OFF . - BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --target ${FUNCHOOK_BUILD_TARGET} + BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} && ${CMAKE_COMMAND} -E copy "${FUNCHOOK_LIBRARY_INSTALL_DIR}" "${FUNCHOOK_INSTALL_DIR}" # --target ${FUNCHOOK_BUILD_TARGET} UPDATE_COMMAND "" BUILD_IN_SOURCE ON LOG_DOWNLOAD ON From 49fb30a6ea18e7aef960618e3be85cf4b52a2b91 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 01:02:59 +0100 Subject: [PATCH 56/66] Solving funchook. --- source/detours/funchook_detour/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index bf9ba843d..6291f09db 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -46,7 +46,7 @@ ExternalProject_Add(${target_depends} # INSTALL_DIR ${FUNCHOOK_INSTALL_DIR} DOWNLOAD_COMMAND "${GIT_EXECUTABLE}" clone --single-branch --branch v${FUNCHOOK_VERSION} --recursive https://github.com/kubo/funchook.git "${FUNCHOOK_SOURCE_DIR}" CONFIGURE_COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_PARALLEL_LEVEL=1 -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON -DCMAKE_INSTALL_PREFIX=${FUNCHOOK_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DFUNCHOOK_BUILD_SHARED=ON -DFUNCHOOK_BUILD_TESTS=OFF -DFUNCHOOK_BUILD_STATIC=OFF . - BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} && ${CMAKE_COMMAND} -E copy "${FUNCHOOK_LIBRARY_INSTALL_DIR}" "${FUNCHOOK_INSTALL_DIR}" # --target ${FUNCHOOK_BUILD_TARGET} + BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --target ${FUNCHOOK_BUILD_TARGET} && ${CMAKE_COMMAND} -E copy "${FUNCHOOK_LIBRARY_INSTALL_DIR}" "${FUNCHOOK_INSTALL_DIR}" UPDATE_COMMAND "" BUILD_IN_SOURCE ON LOG_DOWNLOAD ON From bebf51eaa80d2ba77c136930a01eca0474a3b69d Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 01:10:18 +0100 Subject: [PATCH 57/66] Disable install. --- source/detours/funchook_detour/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index 6291f09db..eceb90a5e 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -46,7 +46,7 @@ ExternalProject_Add(${target_depends} # INSTALL_DIR ${FUNCHOOK_INSTALL_DIR} DOWNLOAD_COMMAND "${GIT_EXECUTABLE}" clone --single-branch --branch v${FUNCHOOK_VERSION} --recursive https://github.com/kubo/funchook.git "${FUNCHOOK_SOURCE_DIR}" CONFIGURE_COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_PARALLEL_LEVEL=1 -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON -DCMAKE_INSTALL_PREFIX=${FUNCHOOK_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DFUNCHOOK_BUILD_SHARED=ON -DFUNCHOOK_BUILD_TESTS=OFF -DFUNCHOOK_BUILD_STATIC=OFF . - BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --target ${FUNCHOOK_BUILD_TARGET} && ${CMAKE_COMMAND} -E copy "${FUNCHOOK_LIBRARY_INSTALL_DIR}" "${FUNCHOOK_INSTALL_DIR}" + BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --target ${FUNCHOOK_BUILD_TARGET} # && ${CMAKE_COMMAND} -E copy "${FUNCHOOK_LIBRARY_INSTALL_DIR}" "${FUNCHOOK_INSTALL_DIR}" UPDATE_COMMAND "" BUILD_IN_SOURCE ON LOG_DOWNLOAD ON From 74899d377d062d3c5aec490f6e329d43ef849634 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 01:10:55 +0100 Subject: [PATCH 58/66] Disable install 2. --- source/detours/funchook_detour/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index eceb90a5e..de2c1f55b 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -43,10 +43,10 @@ set(FUNCHOOK_INCLUDE_DIR "${FUNCHOOK_SOURCE_DIR}/include") ExternalProject_Add(${target_depends} PREFIX funchook SOURCE_DIR ${FUNCHOOK_SOURCE_DIR} - # INSTALL_DIR ${FUNCHOOK_INSTALL_DIR} + INSTALL_DIR ${FUNCHOOK_INSTALL_DIR} DOWNLOAD_COMMAND "${GIT_EXECUTABLE}" clone --single-branch --branch v${FUNCHOOK_VERSION} --recursive https://github.com/kubo/funchook.git "${FUNCHOOK_SOURCE_DIR}" CONFIGURE_COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_PARALLEL_LEVEL=1 -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON -DCMAKE_INSTALL_PREFIX=${FUNCHOOK_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DFUNCHOOK_BUILD_SHARED=ON -DFUNCHOOK_BUILD_TESTS=OFF -DFUNCHOOK_BUILD_STATIC=OFF . - BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --target ${FUNCHOOK_BUILD_TARGET} # && ${CMAKE_COMMAND} -E copy "${FUNCHOOK_LIBRARY_INSTALL_DIR}" "${FUNCHOOK_INSTALL_DIR}" + BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --target ${FUNCHOOK_BUILD_TARGET} && ${CMAKE_COMMAND} -E copy "${FUNCHOOK_LIBRARY_INSTALL_DIR}" "${FUNCHOOK_INSTALL_DIR}" UPDATE_COMMAND "" BUILD_IN_SOURCE ON LOG_DOWNLOAD ON From 1b881169d96c063a157c2ce5f92d2929a21a3868 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 01:28:32 +0100 Subject: [PATCH 59/66] Trying something. --- source/detours/funchook_detour/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index de2c1f55b..837487fd6 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -46,7 +46,7 @@ ExternalProject_Add(${target_depends} INSTALL_DIR ${FUNCHOOK_INSTALL_DIR} DOWNLOAD_COMMAND "${GIT_EXECUTABLE}" clone --single-branch --branch v${FUNCHOOK_VERSION} --recursive https://github.com/kubo/funchook.git "${FUNCHOOK_SOURCE_DIR}" CONFIGURE_COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_PARALLEL_LEVEL=1 -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON -DCMAKE_INSTALL_PREFIX=${FUNCHOOK_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DFUNCHOOK_BUILD_SHARED=ON -DFUNCHOOK_BUILD_TESTS=OFF -DFUNCHOOK_BUILD_STATIC=OFF . - BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --target ${FUNCHOOK_BUILD_TARGET} && ${CMAKE_COMMAND} -E copy "${FUNCHOOK_LIBRARY_INSTALL_DIR}" "${FUNCHOOK_INSTALL_DIR}" + BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --target ${FUNCHOOK_BUILD_TARGET} # && ${CMAKE_COMMAND} -E copy "${FUNCHOOK_LIBRARY_INSTALL_DIR}" "${FUNCHOOK_INSTALL_DIR}" UPDATE_COMMAND "" BUILD_IN_SOURCE ON LOG_DOWNLOAD ON From a07199a5ac0f88a0b87a12b64d7b9cd6f791ec30 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 01:42:50 +0100 Subject: [PATCH 60/66] Solving issues funchook. --- source/detours/funchook_detour/CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index 837487fd6..bb17e9612 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -30,14 +30,17 @@ set(FUNCHOOK_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/funchook/src/funchook") if(WIN32) set(FUNCHOOK_BUILD_TARGET "INSTALL") set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/funchook_dll.${FUNCHOOK_LIBRARY_SUFFIX}") - set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/funchook.${FUNCHOOK_LIBRARY_INSTALL_SUFFIX}") + set(FUNCHOOK_LIBRARY_INSTALL_NAME "funchook.${FUNCHOOK_LIBRARY_INSTALL_SUFFIX}") + set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/${FUNCHOOK_LIBRARY_INSTALL_NAME}") else() set(FUNCHOOK_BUILD_TARGET "install") - set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/libfunchook.${FUNCHOOK_LIBRARY_SUFFIX}") + set(FUNCHOOK_LIBRARY_INSTALL_NAME "libfunchook.${FUNCHOOK_LIBRARY_SUFFIX}") + set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/${FUNCHOOK_LIBRARY_INSTALL_NAME}") set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_LIBRARY_DIR}") endif() set(FUNCHOOK_INSTALL_DIR "${PROJECT_OUTPUT_DIR}") +set(FUNCHOOK_LIBRARY "${FUNCHOOK_INSTALL_DIR}/${FUNCHOOK_LIBRARY_INSTALL_NAME}") set(FUNCHOOK_INCLUDE_DIR "${FUNCHOOK_SOURCE_DIR}/include") ExternalProject_Add(${target_depends} @@ -46,7 +49,8 @@ ExternalProject_Add(${target_depends} INSTALL_DIR ${FUNCHOOK_INSTALL_DIR} DOWNLOAD_COMMAND "${GIT_EXECUTABLE}" clone --single-branch --branch v${FUNCHOOK_VERSION} --recursive https://github.com/kubo/funchook.git "${FUNCHOOK_SOURCE_DIR}" CONFIGURE_COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_PARALLEL_LEVEL=1 -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=ON -DCMAKE_INSTALL_PREFIX=${FUNCHOOK_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DFUNCHOOK_BUILD_SHARED=ON -DFUNCHOOK_BUILD_TESTS=OFF -DFUNCHOOK_BUILD_STATIC=OFF . - BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --target ${FUNCHOOK_BUILD_TARGET} # && ${CMAKE_COMMAND} -E copy "${FUNCHOOK_LIBRARY_INSTALL_DIR}" "${FUNCHOOK_INSTALL_DIR}" + BUILD_COMMAND ${CMAKE_COMMAND} -E env CMAKE_BUILD_PARALLEL_LEVEL=1 ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy "${FUNCHOOK_LIBRARY_INSTALL_DIR}" "${FUNCHOOK_INSTALL_DIR}" UPDATE_COMMAND "" BUILD_IN_SOURCE ON LOG_DOWNLOAD ON @@ -174,7 +178,7 @@ target_include_directories(${target} target_link_libraries(${target} PRIVATE ${META_PROJECT_NAME}::metacall # MetaCall library - ${FUNCHOOK_LIBRARY_DIR} # FuncHook libraries + ${FUNCHOOK_LIBRARY} # FuncHook libraries PUBLIC ${DEFAULT_LIBRARIES} @@ -228,7 +232,7 @@ target_link_options(${target} # Dependency install(FILES - ${FUNCHOOK_LIBRARY_INSTALL_DIR} + ${FUNCHOOK_LIBRARY} DESTINATION ${INSTALL_LIB} COMPONENT runtime ) From 7cb91d1b489d10fe9efb98a247f6d2af407f01bb Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 17:10:44 +0100 Subject: [PATCH 61/66] Testing platform ci. --- .github/workflows/docker-hub-platform.yml | 239 +++++++++++----------- 1 file changed, 120 insertions(+), 119 deletions(-) diff --git a/.github/workflows/docker-hub-platform.yml b/.github/workflows/docker-hub-platform.yml index b3d706e38..88100ac34 100644 --- a/.github/workflows/docker-hub-platform.yml +++ b/.github/workflows/docker-hub-platform.yml @@ -20,127 +20,127 @@ env: BUILDKIT_VERSION: 0.13.0 jobs: - build: - name: Build - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - platform: - - linux/amd64 - - linux/386 - - linux/arm64 - - linux/riscv64 - - linux/ppc64le - - linux/s390x - - linux/arm/v7 - - linux/arm/v6 - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker BuildX - uses: docker/setup-buildx-action@v3 - with: - version: v${{ env.BUILDKIT_VERSION }} - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - - name: Build MetaCall Docker Images - env: - METACALL_PLATFORM: ${{ matrix.platform }} - run: | - ./docker-compose.sh platform - - - name: Tag Platform Images - run: | - platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') - echo "Platform Tag: ${platform_tag}" - for tag in "deps" "dev" "runtime" "cli"; do - docker tag metacall/${IMAGE_NAME}:${tag} \ - ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag} - done - - - name: Push Platform Images - run: | - platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') - for tag in "deps" "dev" "runtime" "cli"; do - echo "Pushing image for tag: ${tag} with platform: ${platform_tag}" - docker push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag} - done - - - name: Run Tests - run: | - set -exuo pipefail - platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') - cat < Dockerfile.test - FROM ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform_tag} - RUN echo "console.log('abcde')" > script.js - RUN metacallcli script.js - EOF - - docker build --platform ${{ matrix.platform }} -f Dockerfile.test -t test-image . - docker run --rm --platform=${{ matrix.platform }} test-image - - manifest: - name: Create and Push Manifest Lists - needs: build - runs-on: ubuntu-latest - steps: - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - - name: Create and Push Manifest Lists - run: | - for tag in "deps" "dev" "runtime" "cli"; do - echo "Creating manifest for tag: $tag" - platform_tags="" - for platform in "linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6"; do - platform_tag=$(echo "${platform}" | tr '/' '-') - platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag}" - done - echo "Creating manifest with tags: ${platform_tags}" - docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} ${platform_tags} --amend - docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} - done - - - name: Create Version Specific Tags - if: startsWith(github.ref, 'refs/tags/') - run: | - VERSION=${GITHUB_REF#refs/tags/v} - tags=("deps" "dev" "runtime" "cli") - platforms=("linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6") - for tag in "${tags[@]}"; do - platform_tags="" - for platform in "${platforms[@]}"; do - platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform}" - done - docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} ${platform_tags} --amend - docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} - done - - cli_platform_tags="" - for platform in ${{ matrix.platform }}; do - cli_platform_tags="${cli_platform_tags} ${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform}" - done - docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:latest ${cli_platform_tags} --amend - docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:latest + # build: + # name: Build + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # platform: + # - linux/amd64 + # - linux/386 + # - linux/arm64 + # - linux/riscv64 + # - linux/ppc64le + # - linux/s390x + # - linux/arm/v7 + # - linux/arm/v6 + # steps: + # - name: Checkout Repository + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v3 + + # - name: Set up Docker BuildX + # uses: docker/setup-buildx-action@v3 + # with: + # version: v${{ env.BUILDKIT_VERSION }} + + # - name: Login to Docker Hub + # uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKER_HUB_USERNAME }} + # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + # - name: Build MetaCall Docker Images + # env: + # METACALL_PLATFORM: ${{ matrix.platform }} + # run: | + # ./docker-compose.sh platform + + # - name: Tag Platform Images + # run: | + # platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') + # echo "Platform Tag: ${platform_tag}" + # for tag in "deps" "dev" "runtime" "cli"; do + # docker tag metacall/${IMAGE_NAME}:${tag} \ + # ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag} + # done + + # - name: Push Platform Images + # run: | + # platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') + # for tag in "deps" "dev" "runtime" "cli"; do + # echo "Pushing image for tag: ${tag} with platform: ${platform_tag}" + # docker push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag} + # done + + # - name: Run Tests + # run: | + # set -exuo pipefail + # platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') + # cat < Dockerfile.test + # FROM ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform_tag} + # RUN echo "console.log('abcde')" > script.js + # RUN metacallcli script.js + # EOF + + # docker build --platform ${{ matrix.platform }} -f Dockerfile.test -t test-image . + # docker run --rm --platform=${{ matrix.platform }} test-image + + # manifest: + # name: Create and Push Manifest Lists + # needs: build + # runs-on: ubuntu-latest + # steps: + # - name: Login to Docker Hub + # uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKER_HUB_USERNAME }} + # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + # - name: Create and Push Manifest Lists + # run: | + # for tag in "deps" "dev" "runtime" "cli"; do + # echo "Creating manifest for tag: $tag" + # platform_tags="" + # for platform in "linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6"; do + # platform_tag=$(echo "${platform}" | tr '/' '-') + # platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag}" + # done + # echo "Creating manifest with tags: ${platform_tags}" + # docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} ${platform_tags} --amend + # docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} + # done + + # - name: Create Version Specific Tags + # if: startsWith(github.ref, 'refs/tags/') + # run: | + # VERSION=${GITHUB_REF#refs/tags/v} + # tags=("deps" "dev" "runtime" "cli") + # platforms=("linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6") + # for tag in "${tags[@]}"; do + # platform_tags="" + # for platform in "${platforms[@]}"; do + # platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform}" + # done + # docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} ${platform_tags} --amend + # docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} + # done + + # cli_platform_tags="" + # for platform in ${{ matrix.platform }}; do + # cli_platform_tags="${cli_platform_tags} ${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform}" + # done + # docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:latest ${cli_platform_tags} --amend + # docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:latest cleanup: name: Cleanup Platform Specific Tags - needs: [build, manifest] + # needs: [build, manifest] runs-on: ubuntu-latest if: always() steps: @@ -153,9 +153,10 @@ jobs: for tag in "${tags[@]}"; do tag_to_delete="${tag}-${platform}" echo "Deleting tag: ${tag_to_delete}" + echo "https://hub.docker.com/v2/repositories/${DOCKER_USERNAME}/${IMAGE_NAME}/tags/${tag_to_delete}/" curl -X DELETE \ - -u "${{ secrets.DOCKER_HUB_USERNAME }}:${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" \ + -H "Authorization: Bearer ${{ secrets.DOCKER_HUB_ACCESS_TOKEN_DELETE }}" \ "https://hub.docker.com/v2/repositories/${DOCKER_USERNAME}/${IMAGE_NAME}/tags/${tag_to_delete}/" done done From cd131792ee400948343b24fb78cc2ff15aac168d Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 17:25:52 +0100 Subject: [PATCH 62/66] Enabled github platform. --- .github/workflows/docker-hub-platform.yml | 236 +++++++++++----------- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/.github/workflows/docker-hub-platform.yml b/.github/workflows/docker-hub-platform.yml index 88100ac34..6a004d1eb 100644 --- a/.github/workflows/docker-hub-platform.yml +++ b/.github/workflows/docker-hub-platform.yml @@ -20,127 +20,127 @@ env: BUILDKIT_VERSION: 0.13.0 jobs: - # build: - # name: Build - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # platform: - # - linux/amd64 - # - linux/386 - # - linux/arm64 - # - linux/riscv64 - # - linux/ppc64le - # - linux/s390x - # - linux/arm/v7 - # - linux/arm/v6 - # steps: - # - name: Checkout Repository - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v3 - - # - name: Set up Docker BuildX - # uses: docker/setup-buildx-action@v3 - # with: - # version: v${{ env.BUILDKIT_VERSION }} - - # - name: Login to Docker Hub - # uses: docker/login-action@v3 - # with: - # username: ${{ secrets.DOCKER_HUB_USERNAME }} - # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - # - name: Build MetaCall Docker Images - # env: - # METACALL_PLATFORM: ${{ matrix.platform }} - # run: | - # ./docker-compose.sh platform - - # - name: Tag Platform Images - # run: | - # platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') - # echo "Platform Tag: ${platform_tag}" - # for tag in "deps" "dev" "runtime" "cli"; do - # docker tag metacall/${IMAGE_NAME}:${tag} \ - # ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag} - # done - - # - name: Push Platform Images - # run: | - # platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') - # for tag in "deps" "dev" "runtime" "cli"; do - # echo "Pushing image for tag: ${tag} with platform: ${platform_tag}" - # docker push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag} - # done - - # - name: Run Tests - # run: | - # set -exuo pipefail - # platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') - # cat < Dockerfile.test - # FROM ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform_tag} - # RUN echo "console.log('abcde')" > script.js - # RUN metacallcli script.js - # EOF - - # docker build --platform ${{ matrix.platform }} -f Dockerfile.test -t test-image . - # docker run --rm --platform=${{ matrix.platform }} test-image - - # manifest: - # name: Create and Push Manifest Lists - # needs: build - # runs-on: ubuntu-latest - # steps: - # - name: Login to Docker Hub - # uses: docker/login-action@v3 - # with: - # username: ${{ secrets.DOCKER_HUB_USERNAME }} - # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - # - name: Create and Push Manifest Lists - # run: | - # for tag in "deps" "dev" "runtime" "cli"; do - # echo "Creating manifest for tag: $tag" - # platform_tags="" - # for platform in "linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6"; do - # platform_tag=$(echo "${platform}" | tr '/' '-') - # platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag}" - # done - # echo "Creating manifest with tags: ${platform_tags}" - # docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} ${platform_tags} --amend - # docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} - # done - - # - name: Create Version Specific Tags - # if: startsWith(github.ref, 'refs/tags/') - # run: | - # VERSION=${GITHUB_REF#refs/tags/v} - # tags=("deps" "dev" "runtime" "cli") - # platforms=("linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6") - # for tag in "${tags[@]}"; do - # platform_tags="" - # for platform in "${platforms[@]}"; do - # platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform}" - # done - # docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} ${platform_tags} --amend - # docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} - # done - - # cli_platform_tags="" - # for platform in ${{ matrix.platform }}; do - # cli_platform_tags="${cli_platform_tags} ${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform}" - # done - # docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:latest ${cli_platform_tags} --amend - # docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:latest + build: + name: Build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: + - linux/amd64 + - linux/386 + - linux/arm64 + - linux/riscv64 + - linux/ppc64le + - linux/s390x + - linux/arm/v7 + - linux/arm/v6 + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker BuildX + uses: docker/setup-buildx-action@v3 + with: + version: v${{ env.BUILDKIT_VERSION }} + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Build MetaCall Docker Images + env: + METACALL_PLATFORM: ${{ matrix.platform }} + run: | + ./docker-compose.sh platform + + - name: Tag Platform Images + run: | + platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') + echo "Platform Tag: ${platform_tag}" + for tag in "deps" "dev" "runtime" "cli"; do + docker tag metacall/${IMAGE_NAME}:${tag} \ + ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag} + done + + - name: Push Platform Images + run: | + platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') + for tag in "deps" "dev" "runtime" "cli"; do + echo "Pushing image for tag: ${tag} with platform: ${platform_tag}" + docker push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag} + done + + - name: Run Tests + run: | + set -exuo pipefail + platform_tag=$(echo "${{ matrix.platform }}" | tr '/' '-') + cat < Dockerfile.test + FROM ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform_tag} + RUN echo "console.log('abcde')" > script.js + RUN metacallcli script.js + EOF + + docker build --platform ${{ matrix.platform }} -f Dockerfile.test -t test-image . + docker run --rm --platform=${{ matrix.platform }} test-image + + manifest: + name: Create and Push Manifest Lists + needs: build + runs-on: ubuntu-latest + steps: + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Create and Push Manifest Lists + run: | + for tag in "deps" "dev" "runtime" "cli"; do + echo "Creating manifest for tag: $tag" + platform_tags="" + for platform in "linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6"; do + platform_tag=$(echo "${platform}" | tr '/' '-') + platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag}" + done + echo "Creating manifest with tags: ${platform_tags}" + docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} ${platform_tags} --amend + docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} + done + + - name: Create Version Specific Tags + if: startsWith(github.ref, 'refs/tags/') + run: | + VERSION=${GITHUB_REF#refs/tags/v} + tags=("deps" "dev" "runtime" "cli") + platforms=("linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6") + for tag in "${tags[@]}"; do + platform_tags="" + for platform in "${platforms[@]}"; do + platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform}" + done + docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} ${platform_tags} --amend + docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} + done + + cli_platform_tags="" + for platform in ${{ matrix.platform }}; do + cli_platform_tags="${cli_platform_tags} ${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform}" + done + docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:latest ${cli_platform_tags} --amend + docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:latest cleanup: name: Cleanup Platform Specific Tags - # needs: [build, manifest] + needs: [build, manifest] runs-on: ubuntu-latest if: always() steps: From 53620afdbf158b9be6451670cf724446d11cef60 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 21:55:54 +0100 Subject: [PATCH 63/66] Add dynamic detection of asan paths. --- cmake/CompileOptions.cmake | 40 +++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/cmake/CompileOptions.cmake b/cmake/CompileOptions.cmake index a5610945c..0dad28d80 100644 --- a/cmake/CompileOptions.cmake +++ b/cmake/CompileOptions.cmake @@ -149,17 +149,51 @@ else() set(SANITIZER_COMPILE_DEFINITIONS) endif() +function(find_sanitizer NAME LINK_OPTION) + string(TOUPPER "${NAME}" NAME_UPPER) + set(SANITIZER_PROGRAM_CODE "int main() {return 0;}") + message(STATUS "${CMAKE_CURRENT_BINARY_DIR}/sanitizer_locate.cpp") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/sanitizer_locate.cpp" "${SANITIZER_PROGRAM_CODE}") + + try_compile( + STATUS + ${PROJECT_OUTPUT_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/sanitizer_locate.cpp + OUTPUT_VARIABLE SANITIZER_COMPILER_OUTPUT + LINK_OPTIONS ${LINK_OPTION} + COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/sanitizer_locate + ) + + if(NOT STATUS) + message(FATAL_ERROR "Could not find location for lib${NAME}: ${SANITIZER_COMPILER_OUTPUT}") + return() + endif() + + file(GET_RUNTIME_DEPENDENCIES + EXECUTABLES ${CMAKE_CURRENT_BINARY_DIR}/sanitizer_locate + RESOLVED_DEPENDENCIES_VAR SANITIZER_PROGRAM_LIBRARIES + ) + + foreach(DEPENDENCY IN LISTS SANITIZER_PROGRAM_LIBRARIES) + string(FIND "${DEPENDENCY}" "${NAME}" POSITION) + if(POSITION GREATER -1) + set(LIB${NAME_UPPER}_PATH "${DEPENDENCY}" PARENT_SCOPE) + return() + endif() + endforeach() +endfunction() + if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang") if(OPTION_BUILD_THREAD_SANITIZER) - execute_process(COMMAND ${CMAKE_C_COMPILER} -print-file-name=libtsan${CMAKE_SHARED_LIBRARY_SUFFIX} OUTPUT_VARIABLE LIBTSAN_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) + find_sanitizer(tsan -fsanitize=thread) set(SANITIZER_LIBRARIES_PATH "${LIBTSAN_PATH}" ) elseif(OPTION_BUILD_MEMORY_SANITIZER) set(SANITIZER_LIBRARIES_PATH) # TODO elseif(OPTION_BUILD_ADDRESS_SANITIZER) - execute_process(COMMAND ${CMAKE_C_COMPILER} -print-file-name=libasan${CMAKE_SHARED_LIBRARY_SUFFIX} OUTPUT_VARIABLE LIBASAN_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${CMAKE_C_COMPILER} -print-file-name=libubsan${CMAKE_SHARED_LIBRARY_SUFFIX} OUTPUT_VARIABLE LIBUBSAN_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) + find_sanitizer(asan -fsanitize=address) + find_sanitizer(ubsan -fsanitize=undefined) set(SANITIZER_LIBRARIES_PATH "${LIBASAN_PATH}" "${LIBUBSAN_PATH}" From f8c7b4cfd958f98fe5ecad1e94ee4c2502caca5e Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Wed, 26 Feb 2025 22:44:21 +0100 Subject: [PATCH 64/66] Solve issues on funchook windows. --- cmake/CompileOptions.cmake | 1 - source/detours/funchook_detour/CMakeLists.txt | 13 ++++++++----- source/loaders/node_loader/CMakeLists.txt | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cmake/CompileOptions.cmake b/cmake/CompileOptions.cmake index 0dad28d80..e72d648a1 100644 --- a/cmake/CompileOptions.cmake +++ b/cmake/CompileOptions.cmake @@ -152,7 +152,6 @@ endif() function(find_sanitizer NAME LINK_OPTION) string(TOUPPER "${NAME}" NAME_UPPER) set(SANITIZER_PROGRAM_CODE "int main() {return 0;}") - message(STATUS "${CMAKE_CURRENT_BINARY_DIR}/sanitizer_locate.cpp") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/sanitizer_locate.cpp" "${SANITIZER_PROGRAM_CODE}") try_compile( diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index bb17e9612..2f953a411 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -29,18 +29,21 @@ set(FUNCHOOK_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/funchook/src/funchook") if(WIN32) set(FUNCHOOK_BUILD_TARGET "INSTALL") - set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/funchook_dll.${FUNCHOOK_LIBRARY_SUFFIX}") + set(FUNCHOOK_LIBRARY_NAME "funchook_dll.${FUNCHOOK_LIBRARY_SUFFIX}") + set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/${FUNCHOOK_LIBRARY_NAME}") set(FUNCHOOK_LIBRARY_INSTALL_NAME "funchook.${FUNCHOOK_LIBRARY_INSTALL_SUFFIX}") set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/${FUNCHOOK_LIBRARY_INSTALL_NAME}") else() set(FUNCHOOK_BUILD_TARGET "install") - set(FUNCHOOK_LIBRARY_INSTALL_NAME "libfunchook.${FUNCHOOK_LIBRARY_SUFFIX}") - set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/${FUNCHOOK_LIBRARY_INSTALL_NAME}") + set(FUNCHOOK_LIBRARY_NAME "libfunchook.${FUNCHOOK_LIBRARY_SUFFIX}") + set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/${FUNCHOOK_LIBRARY_NAME}") + set(FUNCHOOK_LIBRARY_INSTALL_NAME "${FUNCHOOK_LIBRARY_NAME}") set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_LIBRARY_DIR}") endif() set(FUNCHOOK_INSTALL_DIR "${PROJECT_OUTPUT_DIR}") -set(FUNCHOOK_LIBRARY "${FUNCHOOK_INSTALL_DIR}/${FUNCHOOK_LIBRARY_INSTALL_NAME}") +set(FUNCHOOK_LIBRARY "${PROJECT_OUTPUT_DIR}/${FUNCHOOK_LIBRARY_NAME}") +set(FUNCHOOK_LIBRARY_INSTALL "${PROJECT_OUTPUT_DIR}/${FUNCHOOK_LIBRARY_INSTALL_NAME}") set(FUNCHOOK_INCLUDE_DIR "${FUNCHOOK_SOURCE_DIR}/include") ExternalProject_Add(${target_depends} @@ -232,7 +235,7 @@ target_link_options(${target} # Dependency install(FILES - ${FUNCHOOK_LIBRARY} + ${FUNCHOOK_LIBRARY_INSTALL} DESTINATION ${INSTALL_LIB} COMPONENT runtime ) diff --git a/source/loaders/node_loader/CMakeLists.txt b/source/loaders/node_loader/CMakeLists.txt index 5536fa202..e557fba41 100644 --- a/source/loaders/node_loader/CMakeLists.txt +++ b/source/loaders/node_loader/CMakeLists.txt @@ -157,6 +157,7 @@ target_link_libraries(${target} PRIVATE ${META_PROJECT_NAME}::metacall # MetaCall library + # TODO: Replace this by /FORCE:UNRESOLVED on MSVC for later on resolving it ourselves? $<$:${NodeJS_LIBRARY}> # NodeJS library PUBLIC From 06d548199898bd39a96672a5e19559428a816558 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 27 Feb 2025 19:40:44 +0100 Subject: [PATCH 65/66] Solve issues in funchook windows. --- source/detours/funchook_detour/CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/detours/funchook_detour/CMakeLists.txt b/source/detours/funchook_detour/CMakeLists.txt index 2f953a411..ac782f31d 100644 --- a/source/detours/funchook_detour/CMakeLists.txt +++ b/source/detours/funchook_detour/CMakeLists.txt @@ -30,19 +30,18 @@ set(FUNCHOOK_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/funchook/src/funchook") if(WIN32) set(FUNCHOOK_BUILD_TARGET "INSTALL") set(FUNCHOOK_LIBRARY_NAME "funchook_dll.${FUNCHOOK_LIBRARY_SUFFIX}") - set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/${FUNCHOOK_LIBRARY_NAME}") + set(FUNCHOOK_LIBRARY "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/${FUNCHOOK_LIBRARY_NAME}") set(FUNCHOOK_LIBRARY_INSTALL_NAME "funchook.${FUNCHOOK_LIBRARY_INSTALL_SUFFIX}") set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/${FUNCHOOK_LIBRARY_INSTALL_NAME}") else() set(FUNCHOOK_BUILD_TARGET "install") set(FUNCHOOK_LIBRARY_NAME "libfunchook.${FUNCHOOK_LIBRARY_SUFFIX}") - set(FUNCHOOK_LIBRARY_DIR "${FUNCHOOK_SOURCE_DIR}/${FUNCHOOK_LIBRARY_NAME}") + set(FUNCHOOK_LIBRARY "${FUNCHOOK_SOURCE_DIR}/${FUNCHOOK_LIBRARY_NAME}") set(FUNCHOOK_LIBRARY_INSTALL_NAME "${FUNCHOOK_LIBRARY_NAME}") - set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_LIBRARY_DIR}") + set(FUNCHOOK_LIBRARY_INSTALL_DIR "${FUNCHOOK_LIBRARY}") endif() set(FUNCHOOK_INSTALL_DIR "${PROJECT_OUTPUT_DIR}") -set(FUNCHOOK_LIBRARY "${PROJECT_OUTPUT_DIR}/${FUNCHOOK_LIBRARY_NAME}") set(FUNCHOOK_LIBRARY_INSTALL "${PROJECT_OUTPUT_DIR}/${FUNCHOOK_LIBRARY_INSTALL_NAME}") set(FUNCHOOK_INCLUDE_DIR "${FUNCHOOK_SOURCE_DIR}/include") From 120a38322c6142dfbc1e1499ef7d03826c8b236a Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia Date: Thu, 27 Feb 2025 19:41:18 +0100 Subject: [PATCH 66/66] Solve issues in github platform. --- .github/workflows/docker-hub-platform.yml | 57 ++++++++++++++--------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/.github/workflows/docker-hub-platform.yml b/.github/workflows/docker-hub-platform.yml index 6a004d1eb..123c572b4 100644 --- a/.github/workflows/docker-hub-platform.yml +++ b/.github/workflows/docker-hub-platform.yml @@ -94,6 +94,8 @@ jobs: manifest: name: Create and Push Manifest Lists needs: build + # Only run when master or when tagging a version + if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.event_name != 'pull_request' runs-on: ubuntu-latest steps: - name: Login to Docker Hub @@ -104,10 +106,15 @@ jobs: - name: Create and Push Manifest Lists run: | - for tag in "deps" "dev" "runtime" "cli"; do + tags=("deps" "dev" "runtime" "cli") + platforms=("linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6") + + echo "Create all the tags by platform" + + for tag in "${tags[@]}"; do echo "Creating manifest for tag: $tag" platform_tags="" - for platform in "linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6"; do + for platform in "${platforms[@]}"; do platform_tag=$(echo "${platform}" | tr '/' '-') platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag}" done @@ -116,28 +123,32 @@ jobs: docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag} done - - name: Create Version Specific Tags - if: startsWith(github.ref, 'refs/tags/') - run: | - VERSION=${GITHUB_REF#refs/tags/v} - tags=("deps" "dev" "runtime" "cli") - platforms=("linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6") - for tag in "${tags[@]}"; do - platform_tags="" - for platform in "${platforms[@]}"; do - platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform}" - done - docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} ${platform_tags} --amend - docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} - done + echo "Create the latest tag" cli_platform_tags="" - for platform in ${{ matrix.platform }}; do - cli_platform_tags="${cli_platform_tags} ${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform}" + for platform in ${platforms[@]}"; do + platform_tag=$(echo "${platform}" | tr '/' '-') + cli_platform_tags="${cli_platform_tags} ${DOCKER_USERNAME}/${IMAGE_NAME}:cli-${platform_tag}" done docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:latest ${cli_platform_tags} --amend docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:latest + if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" = true ]]; then + VERSION=${GITHUB_REF#refs/tags/v} + + echo "Create the version ${VERSION} tag" + + for tag in "${tags[@]}"; do + platform_tags="" + for platform in "${platforms[@]}"; do + platform_tag=$(echo "${platform}" | tr '/' '-') + platform_tags="${platform_tags} ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${tag}-${platform_tag}" + done + docker manifest create ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} ${platform_tags} --amend + docker manifest push ${DOCKER_REGISTRY}/${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}-${tag} + done + fi + cleanup: name: Cleanup Platform Specific Tags needs: [build, manifest] @@ -146,12 +157,14 @@ jobs: steps: - name: Remove Platform-Specific Tags run: | - platforms=("linux-amd64" "linux-386" "linux-arm64" "linux-riscv64" "linux-ppc64le" "linux-s390x" "linux-arm-v7" "linux-arm-v6") tags=("deps" "dev" "runtime" "cli") + platforms=("linux/amd64" "linux/386" "linux/arm64" "linux/riscv64" "linux/ppc64le" "linux/s390x" "linux/arm/v7" "linux/arm/v6") + + for tag in "${tags[@]}"; do + for platform in "${platforms[@]}"; do + platform_tag=$(echo "${platform}" | tr '/' '-') + tag_to_delete="${tag}-${platform_tag}" - for platform in "${platforms[@]}"; do - for tag in "${tags[@]}"; do - tag_to_delete="${tag}-${platform}" echo "Deleting tag: ${tag_to_delete}" echo "https://hub.docker.com/v2/repositories/${DOCKER_USERNAME}/${IMAGE_NAME}/tags/${tag_to_delete}/"