Open Pyrolistical opened 5 months ago
Passing the struct as pointer works, and replacing the struct with a u8 also works. So it has something to do with copy by value.
im getting some (unrelated) weird build errors from this but i believe the problem is this line
https://github.com/Pyrolistical/dynlib-struct-pass-by-value-repo/blob/ace0ec3aff2613a43b84b0b12e26c21cec2bbc07/src/main.zig#L18
you need to add callconv(.C)
. this should probably be checked in the DynLib functions
@xdBronch yep! that is issue. but can DynLib assert something for function pointers missing callconv? maybe assert callconv is not the default .Unspecified
?
that might work, i wouldve asserted that its specifically the C callconv idk what happens with any of the others
Zig Version
0.13.0-dev.46+3648d7df1
Steps to Reproduce and Observed Behavior
Env: Windows 11 Version 10.0.22631 Build 22631
Repo: https://github.com/Pyrolistical/dynlib-struct-pass-by-value-repo Run
zig build run
Outputs:
Expected Behavior
Expected DynLib to be the same as extern: