2016-09-11 09:42:19 +00:00
|
|
|
/**
|
2016-09-11 20:20:15 +00:00
|
|
|
* Author......: See docs/credits.txt
|
2016-09-11 09:42:19 +00:00
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common.h"
|
2019-01-14 09:11:23 +00:00
|
|
|
#include "types.h"
|
2016-09-11 09:42:19 +00:00
|
|
|
#include "dynloader.h"
|
2016-10-01 11:03:31 +00:00
|
|
|
|
|
|
|
#ifdef _WIN
|
|
|
|
|
2019-01-14 09:11:23 +00:00
|
|
|
hc_dynlib_t hc_dlopen (LPCSTR lpLibFileName)
|
2016-10-01 11:03:31 +00:00
|
|
|
{
|
|
|
|
return LoadLibraryA (lpLibFileName);
|
|
|
|
}
|
|
|
|
|
2019-01-14 09:11:23 +00:00
|
|
|
BOOL hc_dlclose (hc_dynlib_t hLibModule)
|
2016-10-01 11:03:31 +00:00
|
|
|
{
|
|
|
|
return FreeLibrary (hLibModule);
|
|
|
|
}
|
|
|
|
|
2019-01-14 09:11:23 +00:00
|
|
|
hc_dynfunc_t hc_dlsym (hc_dynlib_t hModule, LPCSTR lpProcName)
|
2016-10-01 11:03:31 +00:00
|
|
|
{
|
|
|
|
return GetProcAddress (hModule, lpProcName);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2019-01-14 09:11:23 +00:00
|
|
|
hc_dynlib_t hc_dlopen (const char *filename)
|
2016-10-01 11:03:31 +00:00
|
|
|
{
|
2018-12-19 15:09:28 +00:00
|
|
|
return dlopen (filename, RTLD_NOW);
|
2016-10-01 11:03:31 +00:00
|
|
|
}
|
|
|
|
|
2019-01-14 09:11:23 +00:00
|
|
|
int hc_dlclose (hc_dynlib_t handle)
|
2016-10-01 11:03:31 +00:00
|
|
|
{
|
|
|
|
return dlclose (handle);
|
|
|
|
}
|
|
|
|
|
2019-01-14 09:11:23 +00:00
|
|
|
hc_dynfunc_t hc_dlsym (hc_dynlib_t handle, const char *symbol)
|
2016-10-01 11:03:31 +00:00
|
|
|
{
|
2018-12-19 15:09:28 +00:00
|
|
|
return dlsym (handle, symbol);
|
2016-10-01 11:03:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|