diff options
Diffstat (limited to 'src/plugin.c')
-rw-r--r-- | src/plugin.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/plugin.c b/src/plugin.c new file mode 100644 index 0000000..53ff00c --- /dev/null +++ b/src/plugin.c @@ -0,0 +1,31 @@ +#ifdef RCC_PLUGINS +# include <dlfcn.h> +# ifndef RTLD_NOW +# define RTLD_NOW 0 +# endif +#endif /* RCC_PLUGINS */ + +rcc_library_handle rccLibraryOpen(char *filename) +{ +#ifdef RCC_PLUGINS + return (rcc_library_handle)dlopen(filename, RTLD_NOW); +#else + return NULL; +#endif /* RCC_PLUGINS */ +} + +void rccLibraryClose(rcc_library_handle handle) +{ +#ifdef RCC_PLUGINS + dlclose(handle); +#endif /* RCC_PLUGINS */ +} + +void* rccLibraryFind(rcc_library_handle handle, const char *symbol) +{ +#ifdef RCC_PLUGINS + return dlsym(handle, symbol); +#else + return NULL; +#endif /* RCC_PLUGINS */ +} |