hbmk2 (mingw): Prevent (null) DLL name in generated import libraries#400
hbmk2 (mingw): Prevent (null) DLL name in generated import libraries#400EricLendvai wants to merge 1 commit intoharbour:masterfrom
Conversation
|
Hello Eric! |
|
Hello Aleksander, Here is a concrete reproduction outline and the underlying mechanism. Summary of the issueOn MinGW (both 32-bit and 64-bit), hbmk2 can generate an import library via This does not appear with MSVC because it uses Minimal reproduction steps (works on mingw32 and mingw64)The core is: make hbmk2 go down the A) Prepare a DLL and a broken
|
|
As far as I worked with multiple build systems: in my opinion we shouldn't defensively add
|
022d1ab to
faf688c
Compare
import libraries generated from .def files on the dlltool path. This is opt-in only (no behavior change unless HBMK_IMPLIBDLLMAP is set), and fixes cases where a .def lacks a LIBRARY directive and dlltool would otherwise produce an import library referencing (null).dll.
faf688c to
88e73a6
Compare
|
Hello Aleksander, I reworked the solution to address the root cause while keeping hbmk2 behavior stable by default. Problem: In MinGW import-lib generation ( Why prior fixes were controversial: Unconditionally passing New approach (this PR): Add an opt-in environment variable Safety / compatibility:
Repro: Use any Usage example:
Also updated ChangeLog.txt to reflect the final implementation: opt-in HBMK_IMPLIBDLLMAP DEF-DLL mapping for dlltool import-lib generation (no default behavior change). I tested this is Mingw, Mingw64 and MSVC64 |
|
I see a conflict exists on the ChangeLog.txt, but I have no access to "Resolve conflicts" button. |
|
I don't currently have time to review this issue - very busy business time. In my opinion stating that LIBRARY keyword is needed to make correct implibs is not true - the tool should pull the filename anyway. Never encountered (null) in such situation. I will verify this later though, so don't treat as definitive answer. For now it seems as extra code solving rare toolchain problem. |
|
Hello Aleksander, |
2026-01-16 01:40 UTC-0800 Eric Lendvai (harbour.wiki)
Harden MinGW dlltool path in win_implib_def() to avoid creating
import libraries with embedded DLL name (null) when the source .def
contains LIBRARY (null) or lacks a LIBRARY line.
+ Sanitize .def to ensure LIBRARY ""
+ Always pass -D "" to dlltool
+ Scoped to MinGW flow; MSVC unaffected
Fixes executables importing (null).dll (observed with libcurl and
other dependencies built via hbmk2).