Martin Mitáš
2017-07-17 10:21:04 UTC
Hello.
In the mCtrl project [1], we build a DLL. The aim is to have
the DLL without the typical symbol suffix decorations (@num).
This is to allow easy use of those symbols with LoadLibrary().
With mingw-w64, when linking against such DLL, the import lib
still needs to provide the decorations as ld tries to find
only decorated symbols.
Unfortunately, AFAIK, the GNU linker has only the option
-Wl,--kill-at. When not used, both the DLL and the generated
import lib have those decorations, making the DLL unfriendly
to LoadLibrary().
When used, none of those have those decorations, making the
import lib unusable with the linker which has created it.
That raises question whether it is really the intended behavior
or bug of that option.
With mingw-w64, I worked around by regenerating the import lib
with gendef and dlltool [2].
But with recent mingw-w64 builds, the gendef is no longer
distributed, making it an etxra pain for e.g. new people.
Is there better way, how to achieve the goal without manual
maintaining of two .def files? (The decorations differ in 32
and 64 bit builds.)
Or can gendef be re-added into future mingw-build releases?
[1]: https://gitgub.com/mity/mctrl
[2]: https://github.com/mity/mctrl/blob/master/mctrl/CMakeLists.txt#L69
Martin
In the mCtrl project [1], we build a DLL. The aim is to have
the DLL without the typical symbol suffix decorations (@num).
This is to allow easy use of those symbols with LoadLibrary().
With mingw-w64, when linking against such DLL, the import lib
still needs to provide the decorations as ld tries to find
only decorated symbols.
Unfortunately, AFAIK, the GNU linker has only the option
-Wl,--kill-at. When not used, both the DLL and the generated
import lib have those decorations, making the DLL unfriendly
to LoadLibrary().
When used, none of those have those decorations, making the
import lib unusable with the linker which has created it.
That raises question whether it is really the intended behavior
or bug of that option.
With mingw-w64, I worked around by regenerating the import lib
with gendef and dlltool [2].
But with recent mingw-w64 builds, the gendef is no longer
distributed, making it an etxra pain for e.g. new people.
Is there better way, how to achieve the goal without manual
maintaining of two .def files? (The decorations differ in 32
and 64 bit builds.)
Or can gendef be re-added into future mingw-build releases?
[1]: https://gitgub.com/mity/mctrl
[2]: https://github.com/mity/mctrl/blob/master/mctrl/CMakeLists.txt#L69
Martin