rust9x / rust9x-sample

Other
13 stars 3 forks source link

Justfile example for static DLL #1

Open erycson-cubo opened 7 months ago

erycson-cubo commented 7 months ago

Would it be possible to provide an example project to compile a static DLL for Windows 2000? I'm trying to create a DLL that has DllMain, and I'm also using crate windows (https://github.com/rust9x/windows-rs)

seritools commented 7 months ago

There shouldn't be anything different from a regular application, other than setting the craty type to cdylib and fixing all .exes in the scripts to be .dll instead.

https://samrambles.com/guides/window-hacking-with-rust/creating-a-dll-with-rust/index.html might also help.

For Windows 2000 (or any NT-based system) you don't need my windows-rs fork anymore - anything version 0.53.0 or higher from the Microsoft repo should now work dfirectly.

erycson-cubo commented 7 months ago

How do I configure the "target" for Windows 2000 in the official repository?? I'm currently using Visual Studio C++ 6 to create the DLL.

seritools commented 7 months ago

You don't need to configure anything inside windows-rs, it just links to import libraries. Just make sure they are available at the paths set here: https://github.com/rust9x/rust9x-sample/blob/main/.cargo/config.toml#L16 it includes a windows.lib with all the import definitions, so it's not even depending on the MSVC platform import libraries.

Even though it's not necessary, I'd recommend using MSVC 2005 (VC8) as the toolset in order to have working panic unwind support.