mingw 3.4.5 missing dlfcn.h?

我的未来我决定 提交于 2021-02-07 05:27:24

问题


is it possible that my mingw 3.4.5 installation is faulty? or is this provided on some other library floating around?

in case you are wondering, dlfcn.h is where stuff like dlopen and dlclose are defined, so it should be pretty standard


回答1:


It's not in my MinGW 3.4.5 installation, so I doubt your installation is faulty. I suppose the the MinGW maintainers expect you to use the Win32 functions supporting dynamic loading (LoadLibrary(), GetProcAddress(), etc.).




回答2:


dlfcn-win32 is a wrapper for dlfcn around the win32 dll functions




回答3:


mingw is an implenentation of a compiler for windows (a gcc port) implementing the win32 API. The functions in dlfcn.h (dlopen/dlsym et. al.) are POSIX, not windows, so no win32 implementation exists. There may be a wrapper in msys or cygwin, but I fear that the differences between the windows DLL and the ELF shared library mechanisms means you'll simply need to port to the windows APIs.




回答4:


I had this problem, and after installing dlfcn-win32-r19.tar.bz2 on windows under cygwin shell, the problem was solved.

https://code.google.com/p/dlfcn-win32/downloads/detail?name=dlfcn-win32-r19.tar.bz2

I hope this help other guys.




回答5:


I know this is an old question, but nonetheless still relevant today, regardless of the version of GCC from MinGW.org which may be in use.

Those who have observed that MinGW is really intended for use with the native Win32 APIs, based on LoadLibrary() and GetProcAddress(), rather than the POSIX specific APIs declared in dlfcn.h, are completely correct; thus, MinGW.org has not traditionally provided any implementation of the dlfcn.h API functions.

However, as of mingwrt-3.21, I needed to implement MinGW functionality which is akin to the POSIX use of dlsym() on the RTLD_DEFAULT address space. Consequently, from this version of the MinGW runtime onwards, I intend to maintain a conforming implementation of the POSIX dlfcn.h APIs, as a wrapper around the LoadLibrary(), GetProcAddress(), and PSAPI.DLL native Win32 APIs.




回答6:


dlfcn.h: No such file or directory

To solve this I had to add to the .pro file :

DEFINES += _WINDOWS


来源:https://stackoverflow.com/questions/1397022/mingw-3-4-5-missing-dlfcn-h

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!