diff options
Diffstat (limited to 'src/os/linux/linux_library.c')
| -rw-r--r-- | src/os/linux/linux_library.c | 25 | 
1 files changed, 25 insertions, 0 deletions
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 <dlfcn.h> +#include <stdio.h> +#include <SDL2/SDL.h> + +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; +} +  | 
