Bug 19051 – Undefined functions Set/GetWindowLongPtr in mingw libs

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2018-07-03T13:25:36Z
Last change time
2019-04-14T07:41:31Z
Keywords
pull
Assigned to
No Owner
Creator
chrismohrfeld

Comments

Comment #0 by chrismohrfeld — 2018-07-03T13:25:36Z
Linking fails when using SetWindowLongPtr and GetWindowLongPtr from core.sys.windows.winuser and compiling to 64-bit. void main() { import std.stdio; import core.sys.windows.winuser; writeln("SetWindowLongPtr = ", SetWindowLongPtr(null, 0, 0)); writeln("GetWindowLongPtr = ", GetWindowLongPtr(null, 0)); } dmd test.d -m64 C:\dmd2\windows\bin\lld-link.exe: warning: test.obj: undefined symbol: SetWindowLongPtrW C:\dmd2\windows\bin\lld-link.exe: warning: test.obj: undefined symbol: GetWindowLongPtrW error: link failed Error: linker exited with status 1 Issue appears to be that these functions are not defined in the mingw 64-bit user32.lib
Comment #1 by chrismohrfeld — 2018-07-03T13:31:51Z
To note: I'm not using VS or MS Build tools, just the DMD zip file from the download site
Comment #2 by desisma — 2018-07-03T13:34:40Z
I can repoduce this issue. ---- C:\D>dmd -m64 R:\test.d -L="C:\D\dmd2\windows\lib64\mingw\user32.lib" C:\D\dmd2\windows\bin\lld-link.exe: warning: app.obj: undefined symbol: SetWindowLongPtrA error: link failed Error: linker exited with status 1 ---- Regards, Elias
Comment #3 by desisma — 2018-07-03T13:38:11Z
(In reply to desisma from comment #2) > I can repoduce this issue. > > ---- > > C:\D>dmd -m64 R:\test.d -L="C:\D\dmd2\windows\lib64\mingw\user32.lib" > > C:\D\dmd2\windows\bin\lld-link.exe: warning: app.obj: undefined symbol: > SetWindowLongPtrA > error: link failed > Error: linker exited with status 1 > > ---- > > Regards, > Elias In order to prevent confusion, I used a different test app than the one posted above. That's why the error message differs :)
Comment #4 by r.sagitario — 2018-07-05T06:28:58Z
Comment #5 by chrismohrfeld — 2018-07-05T12:51:11Z
Seems to have resolved my issue (originally found this when trying to build a vibe.d project), thanks! Out of curiosity, would there be plans to integrate the mingw-w64 libraries?
Comment #6 by r.sagitario — 2018-07-06T06:31:09Z
The definitions of core.sys.windows don't go beyond Windows Vista, and I suspect these are mostly covered by the current libraries. If you want to go further, I recommend using the Windows SDK directly. Visual D has a conversion tool to convert a bunch of headers to D: https://github.com/dlang/visuald/blob/master/c2d/idl2d.d
Comment #7 by dlang-bot — 2019-04-13T19:55:34Z
@wilzbach created dlang/installer pull request #373 "Build mingw on Azure" fixing this issue: - fix Issue 19051 - Undefined functions Set/GetWindowLongPtr in mingw libs - Merge pull request #332 from rainers/add_SetWindowLongPtr Issue 19051 - Undefined functions Set/GetWindowLongPtr in mingw libs https://github.com/dlang/installer/pull/373
Comment #8 by dlang-bot — 2019-04-14T07:41:31Z
dlang/installer pull request #373 "Build mingw on Azure" was merged into master: - 046bf27644b838e7d6a20656ed92a66f6304dc54 by Rainer Schuetze: fix Issue 19051 - Undefined functions Set/GetWindowLongPtr in mingw libs https://github.com/dlang/installer/pull/373