From bd82d030011cd8b9655e5ded6b6df9343b42a6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 4 Feb 2015 14:09:54 +0100 Subject: Imported Upstream version 3.22 --- src/dl.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/dl.c (limited to 'src/dl.c') diff --git a/src/dl.c b/src/dl.c new file mode 100644 index 0000000..4c8e5fc --- /dev/null +++ b/src/dl.c @@ -0,0 +1,52 @@ +/* + * Shared library handling + * Copyright Jan Engelhardt, 2007-2009 + * + * This file is part of libHX. libHX is free software; you can + * redistribute it and/or modify it under the terms of the GNU Lesser + * General Public License as published by the Free Software Foundation; + * either version 2.1 or (at your option) any later version. + */ +#ifdef _WIN32 +# include +#else +# include +#endif +#include +#include "internal.h" + +EXPORT_SYMBOL void *HX_dlopen(const char *file) +{ +#ifdef _WIN32 + return LoadLibrary(file); +#else + return dlopen(file, RTLD_LAZY); +#endif +} + +EXPORT_SYMBOL void *HX_dlsym(void *handle, const char *symbol) +{ +#ifdef _WIN32 + return GetProcAddress(handle, symbol); +#else + return dlsym(handle, symbol); +#endif +} + +EXPORT_SYMBOL void HX_dlclose(void *handle) +{ +#ifdef _WIN32 + FreeLibrary(handle); +#else + dlclose(handle); +#endif +} + +EXPORT_SYMBOL const char *HX_dlerror(void) +{ +#ifdef _WIN32 + return "[Error unavailable on WIN32]"; +#else + return dlerror(); +#endif +} -- cgit v1.2.3