34 #if !defined(__MINGW64__) && ( (_MSC_VER < 1400) || defined(UNDER_CE) )
39 #define GetProcAddressA GetProcAddress
48 constexpr static const int symbolArgAlignment=4;
49 constexpr static const int symbolMaxArguments=12;
52 libhandle_t openLibraryGlobalImpl(
const std::string& pathname)
noexcept override {
53 HANDLE res = LoadLibraryW((LPCWSTR) pathname.c_str());
54 return reinterpret_cast<libhandle_t
>( res );
57 libhandle_t openLibraryLocalImpl(
const std::string& pathname)
noexcept override {
60 HANDLE res = LoadLibraryW((LPCWSTR) pathname.c_str());
61 return reinterpret_cast<libhandle_t
>( res );
64 const char* lookupLibraryPathnameImpl(libhandle_t handle,
const std::string& symbolName)
noexcept override {
66 return 0 != handle ? GetModuleFileNameA(
reinterpret_cast<HANDLE
>(handle) ) : nullptr;
69 symhandle_t lookupSymbolLocalImpl(libhandle_t handle,
const std::string& symbolName)
noexcept override {
70 std::string altSymbolName = symbolName;
71 symhandle_t addr = GetProcAddressA(
reinterpret_cast<HANDLE
>(handle), altSymbolName.c_str());
75 for(
int arg=0; 0==addr && arg<=symbolMaxArguments; arg++) {
76 altSymbolName = symbolName+
"@"+
std::to_string(arg*symbolArgAlignment);
77 addr = GetProcAddressA(
reinterpret_cast<HANDLE
>(handle), altSymbolName.c_str());
83 symhandle_t lookupSymbolGlobalImpl(
const std::string& symbolName)
noexcept override {
85 WARN_PRINT(
"lookupSymbolGlobal: Not supported on Windows");
91 void closeLibraryImpl(libhandle_t handle)
noexcept override {
92 FreeLibrary(
reinterpret_cast<HANDLE
>(handle) );
95 std::string getLastErrorImpl() noexcept
override {
96 const int err = GetLastError();
104 return new jau::os::impl::WindowsDynamicLinker();
Low level secure dynamic linker access.
#define WARN_PRINT(...)
Use for unconditional warning messages, prefix '[elapsed_time] Warning @ FILE:LINE FUNC: '.
std::string to_string(const alphabet &v) noexcept
std::string to_hexstring(value_type const &v) noexcept
Produce a lower-case hexadecimal string representation of the given pointer.
Author: Sven Gothel sgothel@jausoft.com Copyright (c) 2024 Gothel Software e.K.