summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/motif/library/library.c
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/motif/library/library.c')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/library/library.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/library.c b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/library.c
new file mode 100755
index 0000000000..9a2a6e8b8e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/library.c
@@ -0,0 +1,32 @@
+/**
+ * library.c
+ *
+ * This file contains the implementation of the
+ * shared libraries functions.
+ *
+ */
+
+#include <dlfcn.h>
+#include <stdio.h>
+
+unsigned int OpenLibrary(char *name)
+{
+ void * handle = dlopen (name, RTLD_LAZY | RTLD_GLOBAL);
+ if (handle == NULL) {
+ char buf[512];
+ sprintf(buf, "lib%s.so", name);
+ handle = dlopen (buf, 1);
+ }
+ return (unsigned int)handle;
+}
+
+unsigned int LibraryLookupName(unsigned int handle, char *name)
+{
+ if (handle == 0) return 0;
+ return (unsigned int)dlsym ((void *)handle, name);
+}
+
+void CloseLibrary(unsigned int handle)
+{
+ if (handle != 0) dlclose ((void *)handle);
+}