1. 11
    1. 3

      Libraries: Windows programs make system calls into system libraries like kernel32.dll. To link against these there is a corresponding .lib file that the linker uses, and without them you get errors

      Windows .exes use an import table to tell the loader which dlls to load and which functions we want the address of. The required libraries you see are called “import libraries”, which are just static libraries that provide enough information for the linker to build the relevant parts of the import table. By default the windows-sys crate uses the same essentially mechanism but instead of using external libraries it provides its own windows.lib that contains import information for every function it wraps.

      Rust has a new raw-dylib feature so that you do not need these libraries (though it’s not yet used by the standard library). It will build the relevant parts itself using the information it already has. The windows-sys crate does also support this with the windows_raw_dylib feature, but it’s not enabled by default.

      1. 1

        Thanks for the comment! I now understand one of the mysteries from the post – windows-sys currently works without providing lib files because it has some windows-targets crate that provides them.

        Unfortunately, I also discovered that in a larger program the compiler intrinsics (_memset etc.) are missing again, so I am still kind of prodding at it.