rust-cross/cargo-zigbuild

Missing Exports from Windows GNU Target

SBuercklin opened this issue · 1 comments

When I compile the following lib.rs with the accompanying Cargo.toml for x86_64-pc-windows-gnu, the function test_fn is missing from the resulting DLL. However, this code compiles and exposes test_fn for x86_64-unknown-linux-gnu, aarch64-apple-darwin.

I compile the code with cargo zigbuild --release --target *insert_target* using a slightly modified version of the cargo-zigbuild Docker image

source:

#[no_mangle]
pub extern "C" fn test_fn(tag_id_c: i32) -> i32 {
    return tag_id_c;
}

Cargo.toml:

[package]
name = "wincompile"
version = "0.1.0"
edition = "2021"

[dependencies]

[lib]
crate-type = ["cdylib"]

Mostly likely a zig cc issue since there isn't any special handling for DLL in this project, try to reproduce it using zig cc directly and report to zig for help.