Skip to content

ousttrue/zig_uv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libuv from zig

zig-0.13.0

zig-0.14.0

error: lld-link: undefined symbol: __declspec(dllimport) _CrtSetReportHook

#if debug
  add link to ucrtbased

dependencies

master required v1.48.0 has CONTAINING_RECORD issue.

> zig fetch --save=libuv git+https://github.com/libuv/libuv.git

trobule

CONTAINING_RECORD cause runtime INVALID INSTRUCTION

patch for src/win/req-inl.h

INLINE static uv_req_t* uv__overlapped_to_req(OVERLAPPED* overlapped) {
  // cause illegal instruction
  // return CONTAINING_RECORD(overlapped, uv_req_t, u.io.overlapped);
  return (uv_req_t*)((char*)overlapped - offsetof(uv_req_t, u.io.overlapped));
}

same libuv/libuv#4254

merged 2024/08/06

error: dependency loop detected

pub const struct_uv_stream_s = extern struct {
    read_cb: uv_read_cb = @import("std").mem.zeroes(uv_read_cb),
};

// 👆👇

pub const uv_read_cb = ?*const fn ([*c]uv_stream_t, isize, [*c]const uv_buf_t) callconv(.C) void;

// workaround

pub const uv_read_cb = ?*const fn (*anyopaque, isize, [*c]const uv_buf_t) callconv(.C) void;

uvbook

> zig build -l
  install (default)            Copy build artifacts to prefix path
  uninstall                    Remove build artifacts from prefix path
  c_helloworld                 Build & run c_helloworld
  zig_helloworld               Build & run zig_helloworld

> zig build c-helloworld
name c-win32 zig
helloworld o o
idle-basic o o
name c-win32 zig
uvcat o o translated
uvtee o o translated
onchange o o
name c-win32 zig
tcp-echo-server o o translated, TODO: client
udp-dhcp o o translated
dns o o TODO: not work
interfaces o x @cimport error
name c-win32 zig
thread-create c o
locks uv_barrier_wait
queue-work <unistd.h>
queue-cancel <unistd.h>
progress <unistd.h>
name c-win32 zig
spawn o o translated
detach o
signal <unistd.h>
proc-streams o
cgi o and cgi/tick
pipe-echo-server o
multi-echo-server o
name c-win32 zig
uvstop o x
name c-win32 zig
ref-timer o
idle-compute o
uvwget <curl.h>
plugin o and plugin/hello.c
tty o
tty-gravity o o translated

About

libuv zig build and uvbook

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages