Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linker errors for 32-bit msvc builds #87

Closed
dherman opened this issue Sep 7, 2018 · 3 comments · Fixed by #88
Closed

Linker errors for 32-bit msvc builds #87

dherman opened this issue Sep 7, 2018 · 3 comments · Fixed by #88

Comments

@dherman
Copy link
Contributor

dherman commented Sep 7, 2018

I've run into linker errors trying to use os_info::get() in 32-bit Windows (MSVC) builds. I wrote a minimal example that demonstrates the failure, and included an appveyor project so you can see the full output with the error.

Here's the minimal example code, and here's the Appveyor output.

Hope this is helpful!

@dherman
Copy link
Contributor Author

dherman commented Sep 7, 2018

For a bit more context, the linker error is failing to find __imp__RtlGetVersion. I'm a little bit baffled a) at the name mangling and b) that it can't find RtlGetVersion since the link command includes ntdll.lib, which is supposedly the library that contains that symbol. But I'm not an expert at Windows linking so I'm sort of stretching my limitations here. :)

@retep998
Copy link

retep998 commented Sep 7, 2018

The dllimport name mangling is not the issue. The issue is actually that the wrong calling convention is being used.

https://github.com/DarkEld3r/os_info/blob/4f7106f8729e169dfbe08027e9d93a6f083ba831/src/windows/winapi.rs#L35-L38

You want to be using extern "system" for Windows API functions, not extern "C".

@dherman
Copy link
Contributor Author

dherman commented Sep 7, 2018

Yay! I'll create a PR right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants