summaryrefslogtreecommitdiffstats
path: root/funtools/filter/dl.c
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2016-10-27 17:38:41 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2016-10-27 17:38:41 (GMT)
commit5b44fb0d6530c4ff66a446afb69933aa8ffd014f (patch)
treee059f66d1f612e21fe9d83f9620c8715530353ec /funtools/filter/dl.c
parentda2e3d212171bbe64c1af39114fd067308656990 (diff)
parent23c7930d27fe11c4655e1291a07a821dbbaba78d (diff)
downloadblt-5b44fb0d6530c4ff66a446afb69933aa8ffd014f.zip
blt-5b44fb0d6530c4ff66a446afb69933aa8ffd014f.tar.gz
blt-5b44fb0d6530c4ff66a446afb69933aa8ffd014f.tar.bz2
Merge commit '23c7930d27fe11c4655e1291a07a821dbbaba78d' as 'funtools'
Diffstat (limited to 'funtools/filter/dl.c')
-rw-r--r--funtools/filter/dl.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/funtools/filter/dl.c b/funtools/filter/dl.c
new file mode 100644
index 0000000..8e914f2
--- /dev/null
+++ b/funtools/filter/dl.c
@@ -0,0 +1,57 @@
+#ifdef USE_DL
+
+#include <stdio.h>
+#include <dl.h>
+#include <gio.h>
+#include <prsetup.h>
+
+int have_dl = 1;
+
+#ifdef ANSI_FUNC
+void *
+DLOpen(char *name)
+#else
+void *DLOpen(name)
+ char *name;
+#endif
+{
+ void *d;
+ if( !(d=dlopen(name, RTLD_LAZY)) )
+ gerror(stderr, "%s\n", dlerror());
+ return d;
+}
+
+#ifdef ANSI_FUNC
+void *
+DLSym(void *dl, char *name)
+#else
+void *DLSym(dl, name)
+ void *dl;
+ char *name;
+#endif
+{
+ void *d;
+ if( !(d=dlsym(dl, name)) )
+ gerror(stderr, "%s\n", dlerror());
+ return d;
+}
+
+#ifdef ANSI_FUNC
+int
+DLClose(void *dl)
+#else
+int DLClose(dl)
+ void *dl;
+#endif
+{
+ if( dl )
+ return dlclose(dl);
+ else
+ return -1;
+}
+
+#else
+
+int have_dl = 0;
+
+#endif