2017-07-19 00:19:38 +00:00
|
|
|
/*
|
|
|
|
* Mr. 4th Dimention - Allen Webster
|
|
|
|
*
|
|
|
|
* 18.07.2017
|
|
|
|
*
|
|
|
|
* Win32 library wrapper.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
2017-07-19 16:33:12 +00:00
|
|
|
union Library{
|
2017-07-19 00:19:38 +00:00
|
|
|
HMODULE lib;
|
2017-07-19 16:33:12 +00:00
|
|
|
FixSize(LIBRARY_TYPE_SIZE);
|
2017-07-19 00:19:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
internal b32
|
2019-08-16 15:01:17 +00:00
|
|
|
system_load_library_direct(Arena *scratch, Library *library, char *name){
|
2017-07-19 16:33:12 +00:00
|
|
|
AssertLibrarySizes();
|
2017-07-19 00:19:38 +00:00
|
|
|
library->lib = LoadLibraryA(name);
|
|
|
|
b32 success = (library->lib != 0);
|
2017-11-28 19:11:44 +00:00
|
|
|
if (!success){
|
2019-08-16 15:01:17 +00:00
|
|
|
win32_output_error_string(scratch, ErrorString_UseLog);
|
2017-11-28 19:11:44 +00:00
|
|
|
}
|
2017-07-19 00:19:38 +00:00
|
|
|
return(success);
|
|
|
|
}
|
|
|
|
|
|
|
|
internal void*
|
|
|
|
system_get_proc(Library *library, char *name){
|
2019-08-16 15:01:17 +00:00
|
|
|
return(GetProcAddress(library->lib, name));
|
2017-07-19 00:19:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
internal void
|
|
|
|
system_free_library(Library *library){
|
|
|
|
FreeLibrary(library->lib);
|
|
|
|
library->lib = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// BOTTOM
|
|
|
|
|