From 2050c0e0576f05156f192aa4caf48834d2f28b14 Mon Sep 17 00:00:00 2001 From: fschildt Date: Fri, 22 Aug 2025 15:23:11 +0200 Subject: first commit --- src/os/linux/linux_library.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/os/linux/linux_library.c (limited to 'src/os/linux/linux_library.c') diff --git a/src/os/linux/linux_library.c b/src/os/linux/linux_library.c new file mode 100644 index 0000000..bd9efe1 --- /dev/null +++ b/src/os/linux/linux_library.c @@ -0,0 +1,25 @@ +#include +#include +#include + +typedef void PlatformLibrary; + +PlatformLibrary *platform_library_open(const char *path) { + void *handle = dlopen(path, RTLD_NOW); + if (!handle) { + printf("could not open library %s\n", path); + return 0; + } + + return handle; +} + +void platform_library_close(PlatformLibrary *handle) { + dlclose(handle); +} + +void *platform_library_get_proc(PlatformLibrary *handle, const char *name) { + void *addr = dlsym(handle, name); + return addr; +} + -- cgit v1.2.3