digitalmars.D.ldc - windows: imported functions in empty program executable
- novice2 (60/61) Feb 19 2021 LDC - the LLVM D compiler (1.25.0-beta1)
LDC - the LLVM D compiler (1.25.0-beta1) File test.d contain one line: void main () {} Compiled to test.exe by command: ldc2 -release -O3 test.d Result test.exe imported many functions, for example delete registry, networking. Is this bug, or i can change something to avoid this imports?dumpbin /imports test.exe'...' - skipped lines Dump of file test.exe File Type: EXECUTABLE IMAGE Section contains the following imports: ... WS2_32.dll ... 1E WSACleanup 2F WSAGetLastError 3A WSAIoctl 58 WSAStartup A1 accept A2 bind A3 closesocket A4 connect A7 gethostbyaddr A8 gethostbyname AB getpeername AC getprotobyname AD getprotobynumber AE getservbyname AF getservbyport B0 getsockname B1 getsockopt B2 htonl B4 inet_addr B5 inet_ntoa B8 ioctlsocket B9 listen BA ntohl BB ntohs BC recv BD recvfrom BF send C0 sendto C1 setsockopt C2 shutdown C3 socket ... ADVAPI32.dll 25B RegCloseKey 264 RegCreateKeyExW 26F RegDeleteKeyW 273 RegDeleteValueW 27A RegEnumKeyExW 27D RegEnumValueW 27E RegFlushKey 28C RegOpenKeyExW 28F RegOpenKeyW 293 RegQueryInfoKeyW 299 RegQueryValueExW 2A9 RegSetValueExW
Feb 19 2021
On Friday, 19 February 2021 at 19:29:43 UTC, novice2 wrote:LDC - the LLVM D compiler (1.25.0-beta1) File test.d contain one line: void main () {} Compiled to test.exe by command: ldc2 -release -O3 test.d Result test.exe imported many functions, for example delete registry, networking. Is this bug, or i can change something to avoid this imports?You've apparently used the bundled MinGW-w64-based libs, not an MSVC toolchain, which somehow results in deps on WS2_32.dll and ADVAPI32.dll. With VS 2019 on my box, the dummy executable only depends on kernel32.dll. LDC defaults to linking the MSVC runtime statically if an MSVC toolchain is available (see -mscrtlib switch).
Feb 19 2021
On Saturday, 20 February 2021 at 06:10:38 UTC, kinke wrote:You've apparently used the bundled MinGW-w64-based libs [...]It has apparently nothing to do with those libs, but with using the LLD linker instead of the MS linker. With the static MSVC libs, I still get these 2 extra DLL deps when using `-link-internally`.
Feb 19 2021
On Saturday, 20 February 2021 at 06:14:53 UTC, kinke wrote:On Saturday, 20 February 2021 at 06:10:38 UTC, kinke wrote:so, this is problem with mingw and llvm linker...You've apparently used the bundled MinGW-w64-based libs [...]
Feb 20 2021