You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you compile the project as is (zig build cmd), and inspect the exported functions of the .dll, you will see the functions of the .c and .cpp source files correctly exported. I use DLL Export Viewer for this:
Now, if you un-comment line 9 of build.zig,
constlib=b.addSharedLibrary(.{
.name="test",
.root_source_file=b.path("src/root.zig"), // uncomment this
.target=target,
.optimize=optimize,
.strip=true,
});
Now all the C/C++ functions are not exported anymore. Only the .zig one is exported.
I'm not sure if this intended behavior or not, I though I would just point it out beause it seems weird. But it's not the main issue I want to report.
This seems to force the use of libCpp and thus links it (the .dll becomes way bigger).
As a result, all the C exported functions from our source files seem to disappear!
Expected Behavior
The functions of our C/C++ source files should be exported, regardless whether we are linking libCpp or not.
The text was updated successfully, but these errors were encountered:
tuket
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Apr 23, 2024
Zig Version
0.13.0-dev.30+6fd09f8d2
Steps to Reproduce and Observed Behavior
Please find attached a .zip with a minimum reproducible example.
test.zip
I'm testing this in Windows 10.
In this project you will find a build.zig, and 3 different source files (root.zig, root.c, root.cpp).
If you compile the project as is (
zig build
cmd), and inspect the exported functions of the .dll, you will see the functions of the .c and .cpp source files correctly exported. I use DLL Export Viewer for this:Now, if you un-comment line 9 of build.zig,
Now all the C/C++ functions are not exported anymore. Only the .zig one is exported.
I'm not sure if this intended behavior or not, I though I would just point it out beause it seems weird. But it's not the main issue I want to report.
Comment back line 9.
In root.cpp un-comment line 10
This seems to force the use of libCpp and thus links it (the .dll becomes way bigger).
As a result, all the C exported functions from our source files seem to disappear!
Expected Behavior
The functions of our C/C++ source files should be exported, regardless whether we are linking libCpp or not.
The text was updated successfully, but these errors were encountered: