Using both .so and .dll on Windows

后端 未结 3 1767
猫巷女王i
猫巷女王i 2020-12-17 01:04

I am writing a program in windows in C++ in which users will be able to compile extensions in the form of dynamic-link libraries (windows), or shared object files (linux). <

3条回答
  •  星月不相逢
    2020-12-17 01:40

    The short answer is "No"

    That is not about loading but about internal format of dynamic library like expected entry points. Each operating system support it's own format. Hence it won't work.

    • DLL is a PE executable (as are exe on windows)
    • .so is usually an ELF format (like most modern executables on Linux/Unix).

    However on Linux there is some support for PE executable through Wine, and Wine program can use DLL. But that's probably not what you are looking for.

    On Windows there is also some support of ELF format through cygwin, and there is also some compilers that can load coff format (the one used on Unix before ELF). I used DJGPP for this a long time ago.

提交回复
热议问题