Skip to content

MSVC link errors with __imp_ symbols #56839

@aloucks

Description

@aloucks
Contributor

Symbols starting with __imp_ are failing to link on the latest nightly.

Cargo.toml:

[package]
name = "msvc_link_bug"
version = "0.1.0"
edition = "2018"

[dependencies]
glfw = "0.25"

src/main.rs:

use glfw;

fn main() {
    let _glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
}

nightly-2018-12-14-x86_64-pc-windows-msvc <-- works
nightly-2018-12-15-x86_64-pc-windows-msvc <-- link errors

  = note: libglfw-2c7b0cf6c8d5aea7.rlib(win32_window.obj) : error LNK2019: unresolved external symbol __imp_DragQueryFileW referenced in function windowProc
          libglfw-2c7b0cf6c8d5aea7.rlib(win32_window.obj) : error LNK2019: unresolved external symbol __imp_DragQueryPoint referenced in function windowProc
          libglfw-2c7b0cf6c8d5aea7.rlib(win32_window.obj) : error LNK2019: unresolved external symbol __imp_DragFinish referenced in function windowProc
          libglfw-2c7b0cf6c8d5aea7.rlib(win32_window.obj) : error LNK2019: unresolved external symbol __imp_DragAcceptFiles referenced in function createNativeWindow
          C:\temp\msvc_link_bug\target\debug\deps\msvc_link_bug-e81b7a96ee14e48a.exe : fatal error LNK1120: 4 unresolved externals

Maybe related: #56807

Activity

changed the title [-]Link errors with MSVC __imp_ symbols[/-] [+]MSVC link errors with __imp_ symbols[/+] on Dec 15, 2018
nikic

nikic commented on Dec 15, 2018

@nikic
Contributor

Probably due to #56568. At least the first symbol is part of shell32.dll.

Possibly glfw (or whatever is using those) may need to explicitly declare this dependency now that it's no longer implicitly provided.

nikic

nikic commented on Dec 15, 2018

@nikic
Contributor
alexcrichton

alexcrichton commented on Dec 15, 2018

@alexcrichton
Member

Indeed all those symbols are in shell32.dll which was removed from the standard library in the PR @nikic mentioned.

@aloucks the "best" fix here would be for the glfw crate to link to shell32 itself, but do you know if it's possible to get a point release doing that? If it's difficult we could re-add it to libstd for the time being.

added a commit that references this issue on Dec 15, 2018
aloucks

aloucks commented on Dec 19, 2018

@aloucks
ContributorAuthor
added a commit that references this issue on Mar 25, 2019
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alexcrichton@nikic@aloucks

        Issue actions

          MSVC link errors with __imp_ symbols · Issue #56839 · rust-lang/rust