Closed as not planned
Description
Zig Version
0.12.0
Steps to Reproduce and Observed Behavior
Hello! I have been having some issues the os.linux.socket to work.
Problem:
The sockaddr struct is declared in std.os and std.posix. This causes a type conflict when binding to a port because the compiler thinks they are different structs.
(main.zig:14:30: error: expected type 'os.linux.sockaddr', found 'c.darwin.sockaddr')
I was uncertain if this was a skill issue so I did a diff to make sure that they are the same struct.
Here is the code that produces the issue:
const std = @import("std");
const net = std.net;
const os = std.os.linux;
const print = std.debug.print;
pub fn main() !void {
const ip: []const u8 = "127.0.0.1";
const port: u16 = 3000;
const addr = try net.Address.parseIp4(ip, port);
const sock: i32 = @intCast(os.socket(os.AF.INET, os.SOCK.DGRAM, 0));
try os.bind(sock, addr.any, addr.getOsSockLen());
}
Expected Behavior
I would expect to not get this issue since they are exactly the same. I would imagine std.os should reference the std.posix?