diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-01-03 21:52:18 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-01-03 21:52:18 (GMT) |
commit | 4302a869f0212a3e4878e66a7260b434f6584476 (patch) | |
tree | e6976e66edf648406e32b092395121e045301692 /tkimg/compat/tclLoadShl.c | |
parent | a780057cc1b51dd3a557549c3cf2431f09136c0d (diff) | |
parent | 60d692811c12788ed4468d5ff680633304e8f641 (diff) | |
download | blt-4302a869f0212a3e4878e66a7260b434f6584476.zip blt-4302a869f0212a3e4878e66a7260b434f6584476.tar.gz blt-4302a869f0212a3e4878e66a7260b434f6584476.tar.bz2 |
Merge commit '60d692811c12788ed4468d5ff680633304e8f641' as 'tkimg'
Diffstat (limited to 'tkimg/compat/tclLoadShl.c')
-rwxr-xr-x | tkimg/compat/tclLoadShl.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/tkimg/compat/tclLoadShl.c b/tkimg/compat/tclLoadShl.c new file mode 100755 index 0000000..113744c --- /dev/null +++ b/tkimg/compat/tclLoadShl.c @@ -0,0 +1,79 @@ +/*
+ * tclLoadShl.c --
+ *
+ * This procedure provides a version of the TclLoadFile that works
+ * with the "shl_load" and "shl_findsym" library procedures for
+ * dynamic loading (e.g. for HP machines).
+ *
+ * Copyright (c) 1995-1996 Sun Microsystems, Inc.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * SCCS: @(#) tclLoadShl.c 1.5 96/03/15 15:01:44
+ */
+
+#include <dl.h>
+
+/*
+ * On some HP machines, dl.h defines EXTERN; remove that definition.
+ */
+
+#ifdef EXTERN
+# undef EXTERN
+#endif
+
+#include "tcl.h"
+#include "compat/dlfcn.h"
+#include <errno.h>
+
+#ifndef DYNAMIC_PATH
+# define DYNAMIC_PATH 0
+#endif
+
+void *
+dlopen(path, mode)
+ const char *path;
+ int mode;
+{
+ int flags, length;
+
+ if (path == (char *) NULL) {
+ return (void *) PROG_HANDLE;
+ }
+ flags = ((mode & RTLD_NOW) ? BIND_IMMEDIATE : BIND_DEFERRED) |
+ DYNAMIC_PATH;
+#ifdef BIND_VERBOSE
+ length = strlen(path);
+ if ((length > 2) && !(strcmp(path+length-3,".sl"))) {
+ flags |= BIND_VERBOSE;
+ }
+#endif
+ return (void *) shl_load(path, flags, 0L);
+}
+
+void *
+dlsym(handle, symbol)
+ void *handle;
+ const char *symbol;
+{ void *address;
+
+ if (shl_findsym((shl_t *)&handle, symbol,
+ (short) TYPE_UNDEFINED, &address) != 0) {
+ address = NULL;
+ }
+ return address;
+}
+
+char *
+dlerror()
+{
+ return (char *) Tcl_ErrnoMsg(errno);
+}
+
+int
+dlclose(handle)
+ void *handle;
+{
+ return shl_unload((shl_t) handle);
+}
|