summaryrefslogtreecommitdiffstats
path: root/src/plugin.c
blob: a50bff3e5bc59ba22bc7f12fa64e1f0ef43e9b2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>

#include "plugin.h"

#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 */
}