Open kcbanner opened 5 hours ago
dumpbin /exports output (-gnu
):
Dump of file c:\cygwin64\home\kcbanner\temp\dllimport\.zig-cache\o\4c14a708863f64bba4014500ee3c00ae\foo_shared.lib
File Type: LIBRARY
Exports
ordinal name
foo
foo_data
foo_function_pointer
Summary
14 .idata$2
14 .idata$3
8 .idata$4
8 .idata$5
F .idata$6
Dump of file c:\cygwin64\home\kcbanner\temp\dllimport\.zig-cache\o\e9f58199a99136ed4cd21b4b31e8cc3f\foo_cpp_shared.lib
File Type: LIBRARY
Exports
ordinal name
foo_cpp
foo_cpp_data
foo_cpp_function_pointer
Summary
14 .idata$2
14 .idata$3
8 .idata$4
8 .idata$5
13 .idata$6
dumpbin /exports output (-msvc
):
Dump of file c:\cygwin64\home\kcbanner\temp\dllimport\.zig-cache\o\89dd1bf28160503a9c8636fb7182d3a2\foo_shared.lib
File Type: LIBRARY
Exports
ordinal name
foo
foo_data
foo_function_pointer
Summary
14 .idata$2
14 .idata$3
8 .idata$4
8 .idata$5
F .idata$6
Dump of file c:\cygwin64\home\kcbanner\temp\dllimport\.zig-cache\o\a55b9a2d906f932dd72ab4d979d22921\foo_cpp_shared.lib
File Type: LIBRARY
Exports
ordinal name
foo_cpp
foo_cpp_data
foo_cpp_function_pointer
Summary
14 .idata$2
14 .idata$3
8 .idata$4
8 .idata$5
13 .idata$6
The symbols are exported from the respective libs, so this seems to be an issue on the import side.
Zig Version
0.14.0-dev.1951+857383689
Steps to Reproduce and Observed Behavior
extern fn
can succesfully link with function symbols marked with__declspec(dllexport)
, it matches the behaviour as if__declspec(dllimport)
had been used. This works on both-gnu
and-msvc
.However, only with the
-msvc
ABI,extern var
cannot link with data symbols marked with__declspec(dllexport)
.Given this source and build script:
foo.h:
foo.c
foo.hpp:
foo.cpp
Produces this output with -gnu:
But fails to link with -msvc:
Note that only the data symbols are undefined. The functions link as expected.
Expected Behavior
Expected successful linking and matching output to -gnu.