Вопрос

I'm loading *.so plugins on Linux using dlopen, and I'd like to port the plugin functionality to windows with mingw. There is a dlfcn-win32 library that adds a dlopen API around native windows DLL functionality, but this doesn't circumvent Windows's native limitation that DLL's that can't reference symbols inside the main executable, IIUC.

One alternative would be to use the EDLL library, which mimics UNIX functionality by linked unresolved symbols in the shared object when the object is loaded. Perhaps I could then implement a dlfcn wrapper that uses the EDLL library?

Another alternative is simply to generate an import library for the executable, and use dlfcn-win32.

Which of these alternatives is likely to be easier? Note that I expect to compile all of my "plugins" with the executable .

-BenRI

Это было полезно?

Решение

It seems that the standard way of doing this is to generate an import library from the executable. This works quite well with dlfcn-win32, so portability can be achieved with almost no change to the source code.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top