windows: imported functions in empty program executable

kinke noone at nowhere.com
Sat Feb 20 06:10:38 UTC 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).


More information about the digitalmars-d-ldc mailing list