cargo-zigbuild icon indicating copy to clipboard operation
cargo-zigbuild copied to clipboard

Missing Exports from Windows GNU Target

Open SBuercklin opened this issue 1 year ago • 1 comments
trafficstars

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"]

SBuercklin avatar May 13 '24 18:05 SBuercklin

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.

messense avatar May 14 '24 03:05 messense