Created SILC Runtime Toolkit git repository Part II.
[runtime.git] / lib / silcutil / silcdll.c
index 20acef0b20a8889babdd865f64dc8cd306448450..2c5de41d5c07748cf270da59523419b8f83f1ae1 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2007 Pekka Riikonen
+  Copyright (C) 2007 - 2008 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
 
 */
 
-#include "silc.h"
+#include "silcruntime.h"
 
 /* Load shared object */
 
@@ -38,7 +38,8 @@ SilcDll silc_dll_load(const char *object_path)
 #else
   /* XXX Symbian */
 #endif /* SILC_UNIX */
-  SILC_LOG_ERROR(("Shared objects are not supported on this platform"));
+  silc_set_errno_reason(SILC_ERR_NOT_SUPPORTED,
+                       "Shared objects are not supported on this platform");
   return NULL;
 }
 
@@ -47,7 +48,9 @@ SilcDll silc_dll_load(const char *object_path)
 void silc_dll_close(SilcDll dll)
 {
 #ifdef SILC_UNIX
+#if defined(HAVE_DLOPEN)
   dlclose(dll);
+#endif /* HAVE_DLOPEN */
 #elif SILC_WIN32
   FreeLibrary(dll);
 #else
@@ -60,13 +63,16 @@ void silc_dll_close(SilcDll dll)
 void *silc_dll_getsym(SilcDll dll, const char *symbol)
 {
 #ifdef SILC_UNIX
+#if defined(HAVE_DLOPEN)
   return (void *)dlsym(dll, symbol);
+#endif /* HAVE_DLOPEN */
 #elif SILC_WIN32
   return (void *)GetProcAddress(dll, symbol);
 #else
   /* XXX Symbian */
 #endif /* SILC_UNIX */
-  SILC_LOG_ERROR(("Shared objects are not supported on this platform"));
+  silc_set_errno_reason(SILC_ERR_NOT_SUPPORTED,
+                       "Shared objects are not supported on this platform");
   return NULL;
 }
 
@@ -75,7 +81,9 @@ void *silc_dll_getsym(SilcDll dll, const char *symbol)
 const char *silc_dll_error(SilcDll dll)
 {
 #ifdef SILC_UNIX
+#if defined(HAVE_DLOPEN)
   return dlerror();
+#endif /* HAVE_DLOPEN */
 #elif SILC_WIN32
   return NULL;
 #else