aboutsummaryrefslogtreecommitdiff
path: root/std/os
diff options
context:
space:
mode:
Diffstat (limited to 'std/os')
-rw-r--r--std/os/index.zig2
-rw-r--r--std/os/windows/index.zig1
-rw-r--r--std/os/windows/kernel32.zig2
-rw-r--r--std/os/windows/util.zig31
4 files changed, 3 insertions, 33 deletions
diff --git a/std/os/index.zig b/std/os/index.zig
index 1ce9bd7278..a53d1d2050 100644
--- a/std/os/index.zig
+++ b/std/os/index.zig
@@ -58,8 +58,6 @@ pub const windowsWrite = windows_util.windowsWrite;
pub const windowsIsCygwinPty = windows_util.windowsIsCygwinPty;
pub const windowsOpen = windows_util.windowsOpen;
pub const windowsOpenW = windows_util.windowsOpenW;
-pub const windowsLoadDll = windows_util.windowsLoadDll;
-pub const windowsUnloadDll = windows_util.windowsUnloadDll;
pub const createWindowsEnvBlock = windows_util.createWindowsEnvBlock;
pub const WindowsCreateIoCompletionPortError = windows_util.WindowsCreateIoCompletionPortError;
diff --git a/std/os/windows/index.zig b/std/os/windows/index.zig
index fc64db7c37..9d03cf6625 100644
--- a/std/os/windows/index.zig
+++ b/std/os/windows/index.zig
@@ -24,6 +24,7 @@ pub const HANDLE = *c_void;
pub const HCRYPTPROV = ULONG_PTR;
pub const HINSTANCE = *@OpaqueType();
pub const HMODULE = *@OpaqueType();
+pub const FARPROC = *@OpaqueType();
pub const INT = c_int;
pub const LPBYTE = *BYTE;
pub const LPCH = *CHAR;
diff --git a/std/os/windows/kernel32.zig b/std/os/windows/kernel32.zig
index 94b339fa6e..7eec5faba9 100644
--- a/std/os/windows/kernel32.zig
+++ b/std/os/windows/kernel32.zig
@@ -178,6 +178,8 @@ pub extern "kernel32" stdcallcc fn WriteFileEx(hFile: HANDLE, lpBuffer: [*]const
pub extern "kernel32" stdcallcc fn LoadLibraryW(lpLibFileName: [*]const u16) ?HMODULE;
+pub extern "kernel32" stdcallcc fn GetProcAddress(hModule: HMODULE, lpProcName: [*]const u8) ?FARPROC;
+
pub extern "kernel32" stdcallcc fn FreeLibrary(hModule: HMODULE) BOOL;
pub const FILE_NOTIFY_INFORMATION = extern struct {
diff --git a/std/os/windows/util.zig b/std/os/windows/util.zig
index 6534d16f5e..7d983421e0 100644
--- a/std/os/windows/util.zig
+++ b/std/os/windows/util.zig
@@ -188,37 +188,6 @@ pub fn createWindowsEnvBlock(allocator: *mem.Allocator, env_map: *const BufMap)
return allocator.shrink(u16, result, i);
}
-pub fn windowsLoadDllW(dll_path_w: [*]const u16) !windows.HMODULE {
- return windows.LoadLibraryW(dll_path_w) orelse {
- const err = windows.GetLastError();
- switch (err) {
- windows.ERROR.FILE_NOT_FOUND => return error.FileNotFound,
- windows.ERROR.PATH_NOT_FOUND => return error.FileNotFound,
- windows.ERROR.MOD_NOT_FOUND => return error.FileNotFound,
- else => return os.unexpectedErrorWindows(err),
- }
- };
-}
-
-pub fn windowsLoadDll(dll_path: []const u8) !windows.HMODULE {
- const dll_path_w = try sliceToPrefixedFileW(dll_path);
- return windowsLoadDllW(&dll_path_w);
-}
-
-pub fn windowsUnloadDll(hModule: windows.HMODULE) void {
- assert(windows.FreeLibrary(hModule) != 0);
-}
-
-test "InvalidDll" {
- if (builtin.os != builtin.Os.windows) return error.SkipZigTest;
-
- const handle = os.windowsLoadDll("asdf.dll") catch |err| {
- assert(err == error.FileNotFound);
- return;
- };
- @panic("Expected error from function");
-}
-
pub fn windowsFindFirstFile(
dir_path: []const u8,
find_file_data: *windows.WIN32_FIND_DATAW,