Skip to content

user32 is long longer linked from windows version of rust - regression! #18975

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

Closed
blairn opened this issue Nov 15, 2014 · 6 comments
Closed

user32 is long longer linked from windows version of rust - regression! #18975

blairn opened this issue Nov 15, 2014 · 6 comments
Labels
O-windows Operating system: Windows

Comments

@blairn
Copy link

blairn commented Nov 15, 2014

This no longer works, and it use to.
the linker says...

ld: cannot find -luser32.dll

when using the code.

[link(name = "user32")]

extern {
pub fn GetDC(hdc: *const HANDLE) -> HANDLE;
}

this is related to #18617 and #18325

@klutzy
Copy link
Contributor

klutzy commented Nov 15, 2014

I succeeded to build #[link(name = "user32")] extern {} fn main() {} with rust i686/x86_64 nightlies, both on d91a015ab 2014-11-14 23:37:27 +0000.
Could you provide more information: is your rustc homemade or nightly? what's output of rustc -v verbose?
-luser32.dll seems strange since it must be -luser32 without .dll. Could you provide the output of rustc ... -Z print-link-args?

@alexcrichton
Copy link
Member

We recently switch to preferring the bundled gcc provided in the standard distribution, which may also have caused this (unsure though).

@blairn
Copy link
Author

blairn commented Nov 16, 2014

Nightly.

I think #18797 broke it.

rustc 0.13.0-nightly (40fb87d 2014-11-10 23:01:57 +0000)
binary: rustc
commit-hash: 40fb87d
commit-date: 2014-11-10 23:01:57 +0000
host: x86_64-pc-windows-gnu
release: 0.13.0-nightly

@alexcrichton
Copy link
Member

cc @vadimcn

@alexcrichton alexcrichton added the O-windows Operating system: Windows label Nov 16, 2014
@vadimcn
Copy link
Contributor

vadimcn commented Nov 17, 2014

@blairn, your nightly was built before #18797 was merged, though.

This code compiles and runs without any problems using latest 64-bit nightly:

extern crate libc;
use libc::HANDLE;

#[link(name = "user32")]
extern {
    pub fn GetDC(hdc: HANDLE) -> HANDLE;
}

fn main() {
    let hdc = unsafe { GetDC(std::mem::transmute(0i64)) };
    println!("{}", hdc);
}

@blairn
Copy link
Author

blairn commented Nov 19, 2014

It works!, it works :)

I am a very Happy Blair!

@blairn blairn closed this as completed Nov 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

4 participants