Skip to content

std.DynLib corrupts struct passed by value #19841

@Pyrolistical

Description

@Pyrolistical

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:

main main.SomeStruct{ .x = 11 }
viaStructDynLib root.SomeStruct{ .x = 147 }
viaStruct root.SomeStruct{ .x = 11 }

Expected Behavior

Expected DynLib to be the same as extern:

main main.SomeStruct{ .x = 11 }
viaStructDynLib root.SomeStruct{ .x = 11 }
viaStruct root.SomeStruct{ .x = 11 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions