Skip to content

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

Closed
@blairn

Description

@blairn

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

Activity

klutzy

klutzy commented on Nov 15, 2014

@klutzy
Contributor

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

alexcrichton commented on Nov 15, 2014

@alexcrichton
Member

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

blairn

blairn commented on Nov 16, 2014

@blairn
Author

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

alexcrichton commented on Nov 16, 2014

@alexcrichton
Member
vadimcn

vadimcn commented on Nov 17, 2014

@vadimcn
Contributor

@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

blairn commented on Nov 19, 2014

@blairn
Author

It works!, it works :)

I am a very Happy Blair!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alexcrichton@blairn@klutzy@vadimcn

        Issue actions

          user32 is long longer linked from windows version of rust - regression! · Issue #18975 · rust-lang/rust