
header "sys" as sys

+ fn libc_errno() i32 {
    #if OS == win
    let i : i32 = 0
    sys:_get_errno(@ref(i))
    return i
    #else
    return sys:errno
    #end
}

+ fn socket_errno() i32 {
    #if OS == win
    // Windows error
    return WSA.error()
    #else
    // Linux / macos error
    return libc_errno()
    #end
}
