Open tazarov opened 3 weeks ago
we can try this:
template<typename T>
T get_function_address(lib_handle handle, const char* func_name) {
#if defined(_WIN32) || defined(_WIN64)
return reinterpret_cast<T>(GetProcAddress(handle, func_name));
#else
return reinterpret_cast<T>(dlsym(handle, func_name));
#endif
}
// Usage:
init_embedder_f = get_function_address<init_embedder_local_func>(libh, "init_embedder");
if (!init_embedder_f) {
#if defined(_WIN32) || defined(_WIN64)
std::string error_message = "Failed to load init_embedder function: " + GetLastErrorAsString();
#else
std::string error_message = "Failed to load init_embedder function: " + std::string(dlerror());
#endif
throw std::runtime_error(error_message);
}
The following warnings are visibile in logs:
should be fixed with something like: