allow opening of .SO files on linux
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
typedef struct gnLib {
|
typedef struct gnLib {
|
||||||
#ifdef GN_PLATFORM_MACOS
|
#if defined(GN_PLATFORM_MACOS) || defined(GN_PLATFORM_LINUX)
|
||||||
void* dylib;
|
void* dylib;
|
||||||
#endif
|
#endif
|
||||||
} gnLib;
|
} gnLib;
|
||||||
|
|
||||||
gnLib gnLoadLib(const char* path);
|
gnLib gnLoadLib(const char* path);
|
||||||
|
|||||||
+3
-12
@@ -1,32 +1,23 @@
|
|||||||
#include "gryphn_lib.h"
|
#include "gryphn_lib.h"
|
||||||
#ifdef GN_PLATFORM_MACOS
|
#if defined(GN_PLATFORM_MACOS) || defined(GN_PLATFORM_LINUX)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
gnLib gnLoadLib(const char* path) {
|
gnLib gnLoadLib(const char* path) {
|
||||||
#ifdef GN_PLATFORM_MACOS
|
|
||||||
gnLib lib;
|
gnLib lib;
|
||||||
lib.dylib = dlopen(path, RTLD_NOW | RTLD_LOCAL);
|
lib.dylib = dlopen(path, RTLD_NOW | RTLD_LOCAL);
|
||||||
return lib;
|
return lib;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int gnLibValid(const gnLib* lib) {
|
int gnLibValid(const gnLib* lib) {
|
||||||
#ifdef GN_PLATFORM_MACOS
|
|
||||||
return lib->dylib != 0;
|
return lib->dylib != 0;
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void* gnLoadLibFunction(const gnLib* lib, const char* function) {
|
void* gnLoadLibFunction(const gnLib* lib, const char* function) {
|
||||||
#ifdef GN_PLATFORM_MACOS
|
|
||||||
return dlsym(lib->dylib, function);
|
return dlsym(lib->dylib, function);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gnCloseLib(const gnLib* lib) {
|
void gnCloseLib(const gnLib* lib) {
|
||||||
#ifdef GN_PLATFORM_MACOS
|
|
||||||
dlclose(lib->dylib);
|
dlclose(lib->dylib);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
file(GLOB_RECURSE VULKAN_SOURCES CONFIGURE_DEPENDS "src/*.c")
|
||||||
|
add_library(gryphn_vulkan SHARED ${VULKAN_SOURCES})
|
||||||
|
project(gryphn_vulkan LANGUAGES C)
|
||||||
|
set_target_properties(gryphn_vulkan PROPERTIES PREFIX "")
|
||||||
|
target_link_libraries(gryphn_vulkan PRIVATE GryphnLoader)
|
||||||
Reference in New Issue
Block a user