-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Linking error on Windows when recreating a slice from raw parts #25369
Comments
Nice to see an issue related to Windows be filed! Just to be complete, could you tell us what steps are needed to reproduce the bug? Also the contents of Cargo.toml. |
Sure!
Cargo version
Rust version
|
I've often seen this problem arise when the target architecture for gcc/rustc don't match, are you sure that you're matching a 32/64bit rustc with the same bit-ness of gcc? Alternatively, are you running the compiler outside of MinGW (in which case the answer to the first question is yes!) |
@alexcrichton Well, I just installed x86 Rust package, mostly because I need x86 DLL and I didn't want to fiddle with different target architecture when using x64 Windows package etc. I don't have any other MinGW/GCC installation, so I assumed that whatever came bundled with Rust was a-OK. I use cargo to build/test the project, although I'm not exactly sure if that answers your second question :) Also I'm not sure why linking actually passes after adding |
Ah I think I see what's going now, I believe this is a dupe of #18807, so closing in favor of that. Thanks for the report though! |
Background
I wanted to expose a Rust library that would expose C-compatible API & ABI and would be used from C-like platform. What I need to do first is populate an array of structs.
Example
Now when I try to compile that using latest Rust 1.0.0-beta5, I get linking errors:
If I add empty println somewhere in the loop:
Linking actually works.
Unfortunately, when using the DLL in the third party platform, I'm getting stack overflow exception in the library (?!). That only happens when working with arrays though (iterating over a slice created from raw array, for example), passing a singular C struct by reference works just fine.
The text was updated successfully, but these errors were encountered: