|
@@ -1,10 +1,11 @@
|
|
-// +build windows
|
|
|
|
|
|
+//+build windows
|
|
|
|
+//+private
|
|
package dynlib
|
|
package dynlib
|
|
|
|
|
|
import win32 "core:sys/windows"
|
|
import win32 "core:sys/windows"
|
|
import "core:strings"
|
|
import "core:strings"
|
|
|
|
|
|
-load_library :: proc(path: string, global_symbols := false) -> (Library, bool) {
|
|
|
|
|
|
+_load_library :: proc(path: string, global_symbols := false) -> (Library, bool) {
|
|
// NOTE(bill): 'global_symbols' is here only for consistency with POSIX which has RTLD_GLOBAL
|
|
// NOTE(bill): 'global_symbols' is here only for consistency with POSIX which has RTLD_GLOBAL
|
|
|
|
|
|
wide_path := win32.utf8_to_wstring(path, context.temp_allocator)
|
|
wide_path := win32.utf8_to_wstring(path, context.temp_allocator)
|
|
@@ -12,12 +13,12 @@ load_library :: proc(path: string, global_symbols := false) -> (Library, bool) {
|
|
return handle, handle != nil
|
|
return handle, handle != nil
|
|
}
|
|
}
|
|
|
|
|
|
-unload_library :: proc(library: Library) -> bool {
|
|
|
|
|
|
+_unload_library :: proc(library: Library) -> bool {
|
|
ok := win32.FreeLibrary(cast(win32.HMODULE)library)
|
|
ok := win32.FreeLibrary(cast(win32.HMODULE)library)
|
|
return bool(ok)
|
|
return bool(ok)
|
|
}
|
|
}
|
|
|
|
|
|
-symbol_address :: proc(library: Library, symbol: string) -> (ptr: rawptr, found: bool) {
|
|
|
|
|
|
+_symbol_address :: proc(library: Library, symbol: string) -> (ptr: rawptr, found: bool) {
|
|
c_str := strings.clone_to_cstring(symbol, context.temp_allocator)
|
|
c_str := strings.clone_to_cstring(symbol, context.temp_allocator)
|
|
ptr = win32.GetProcAddress(cast(win32.HMODULE)library, c_str)
|
|
ptr = win32.GetProcAddress(cast(win32.HMODULE)library, c_str)
|
|
found = ptr != nil
|
|
found = ptr != nil
|