Is there a simple equivalent to dlopen(NULL, ...) on Windows?
The behavior on POSIX (or at least Linux) is: the returned handle can be used to find exported symbols on the executable as well as on dependent shared objects. To put simply, following
void *lib = dlopen(NULL, RTLD_NOW);
doing dlsym(lib, "memcpy") will return the symbol for memcpy.
On win32, GetModuleHandle(NULL) is almost an equivalent, except that the set of dependent DLLs is not searched for symbols; GetProcAddress(lib, "memcpy") returns NULL.
Any idea? Note: of course, in my application, I don't want to merely access memcpy, but some more complicated symbol, and from a FFI.
You may want to check out https://github.com/dlfcn-win32/dlfcn-win32 which is a
dlopen()implementation for Windows (using mentioned functionsGetModuleHandle/GetProcAddress).