From 268a6dc6d90fcbea1393bc19b319835c4a0f9d0f Mon Sep 17 00:00:00 2001 From: Unknown User <52547845+unknown-v@users.noreply.github.com> Date: Mon, 25 Nov 2019 02:35:41 +0100 Subject: [PATCH] add missing cfns --- vlib/builtin/cfns.v | 17 +++++++++++++++-- vlib/os/os.v | 2 +- vlib/os/os_windows.v | 2 +- vlib/sync/sync_windows.v | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/vlib/builtin/cfns.v b/vlib/builtin/cfns.v index 063f16d43f..c82a3bc819 100644 --- a/vlib/builtin/cfns.v +++ b/vlib/builtin/cfns.v @@ -144,8 +144,21 @@ fn C.FindClose() fn C.MAKELANGID() int fn C.FormatMessage() voidptr fn C.CloseHandle() -fn C.WaitForSingleObject() fn C.GetExitCodeProcess() fn C.RegOpenKeyEx() voidptr fn C.GetTickCount() i64 -fn C.Sleep() \ No newline at end of file + +fn C.Sleep() +fn C.WSAStartup(u16, &voidptr) int +fn C.WSAGetLastError() int +fn C.closesocket(int) int +fn C.vschannel_init(&C.TlsContext) +fn C.request(&C.TlsContext,int, &u16, byteptr, &byteptr) +fn C.vschannel_cleanup(&C.TlsContext) +fn C.URLDownloadToFile(int, &u16,&u16, int, int) +fn C.GetLastError() u32 +fn C.CreateDirectory(byteptr, int) bool +fn C.BCryptGenRandom(int,voidptr,int,int) int +fn C.CreateMutex(int,bool,byteptr) voidptr +fn C.WaitForSingleObject(voidptr,int) int +fn C.ReleaseMutex(voidptr) bool \ No newline at end of file diff --git a/vlib/os/os.v b/vlib/os/os.v index 2e12419f6f..397855d242 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -67,7 +67,7 @@ fn C.ftell(fp voidptr) int fn C.getenv(byteptr) byteptr fn C.sigaction(int, voidptr, int) -fn C.GetLastError() u32 + // read_bytes reads an amount of bytes from the beginning of the file pub fn (f File) read_bytes(size int) []byte { diff --git a/vlib/os/os_windows.v b/vlib/os/os_windows.v index af18ae9f19..33a3dd1a4a 100644 --- a/vlib/os/os_windows.v +++ b/vlib/os/os_windows.v @@ -130,7 +130,7 @@ pub fn dir_exists(path string) bool { return false } -fn C.CreateDirectory(byteptr, int) bool + // mkdir creates a new directory with the specified path. pub fn mkdir(path string) ?bool { diff --git a/vlib/sync/sync_windows.v b/vlib/sync/sync_windows.v index 9ed1113472..74aa807960 100644 --- a/vlib/sync/sync_windows.v +++ b/vlib/sync/sync_windows.v @@ -77,7 +77,7 @@ pub fn (m mut Mutex) lock() { pub fn (m mut Mutex) unlock() { if m.state == .waiting { - if C.ReleaseMutex(m.mx) != 0 { + if ReleaseMutex(m.mx) { m.state = .broken return }