We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
daurnimator asked if zigwin32 had the ability to override types. He suggested the root module could do something like this:
pub const zigwin32_config = struct { pub const overrides = struct { pub const SOME_STRUCT = struct{....} }; };
To support this, whenever I generate a type, instead of this:
pub const SOME_STRUCT = struct { //... };
I could do something like this:
pub const SOME_STRUCT = if (getOverride("SOME_STRUCT")) |o| o else struct { //... };
Where getOverride would look something like:
getOverride
pub fn getOverride(comptime sym: []const u8) ?type { const root = @import("root"); if (@hasDecl(root, "zigwin32_config")) { if (@hasDecl(root.zigwin32_config, "override")) { if (@hasDecl(root.zigwin32_config.override, sym)) { return @field(root.zigwin32_config.override, sym); } } } return null; }
Note that this mechanism could be leveraged to help with a solution to the std interop problem.
std
The text was updated successfully, but these errors were encountered:
if (getOverride("SOME_STRUCT")) |o| o else struct {
getOverride("SOME_STRUCT") orelse struct {....
Note also that overrides would follow the same structures you have, e.g.
overrides
pub const zigwin32_config = struct { pub const overrides = struct { pub const ai = struct { pub const FOO = struct{....} } pub const otherthing = struct { pub const BAR = struct{....} } pub const core = struct { pub const HANDLE = std.os.windows.HANDLE; } }; };
Sorry, something went wrong.
No branches or pull requests
daurnimator asked if zigwin32 had the ability to override types. He suggested the root module could do something like this:
To support this, whenever I generate a type, instead of this:
I could do something like this:
Where
getOverride
would look something like:Note that this mechanism could be leveraged to help with a solution to the
std
interop problem.The text was updated successfully, but these errors were encountered: