Skip to content

Should raw-dylibs defined in windows-targets use import_name_type = "undecorated"? #3285

@glandium

Description

@glandium

Summary

In a complex multi-language project, one may end up using both windows-target and the system libraries directly (that's the case of Firefox). When enabling windows-targets's support for raw-dylib, linking fails when using LLVM's lld-link (I haven't tried link.exe, it might actually work, but the result is probably suboptimal too). The cause for the link failure is possibly a bug in lld-link, but it is a manifestation of the fact that the fake import lib that rust creates with raw-dylib does not agree with the real system import lib, wrt symbol names: on 32-bits windows, the system import lib use the __imp__sym@n form, while the raw-dylib uses the __imp_sym form because of import_name_type = "undecorated".

See llvm/llvm-project#107371 (comment) for more details.

Removing import_name_type = "undecorated" solves the problem.

Crate manifest

No response

Crate code

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions