Skip to content

Unable to export unmangled dll entry points for stdcall #17806

Open

Description

Hi.

After some questions on IRC I think this might be a bug or at least a missing feature:
I'd like to export functions with a name of my choosing. I knew about #[no_mangle] and learned about #[export_name] on IRC, but both fail to work in my case.

Code/test.rs:

pub extern "stdcall" fn stdcall() {
}

#[no_mangle]
pub extern "stdcall" fn stdcall_nomangle() {
}

#[export_name="stdcall_export"]
pub extern "stdcall" fn stdcall_exportname() {
}

pub extern "C" fn c() {
}

#[no_mangle]
pub extern "C" fn c_nomangle() {
}

#[export_name="c_export"]
pub extern "C" fn c_exportname() {
}

Build with rustc --cratetype dylib test.rs

Result:
rustdllexports

So, every single stdcall entry point follows the name@sizeofarguments convention. I have a number of DLLs right in front of me (not based on rust) that export stdcall entries and DON'T use that convention. In fact, I'm reasonably sure that most of the windows API is both using stdcall and exporting 'unmangled' names.

Can I create something similar with rust? Am I missing another attribute? Should no_mangle work in these cases? Should export_name?

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

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.O-windowsOperating system: WindowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions