annotate src/sysdll.c @ 4879:c356806cc933

fix compile errors when --with-msw=no -------------------- ChangeLog entries follow: -------------------- modules/ChangeLog addition: 2010-01-16 Ben Wing <ben@xemacs.org> * common/Makefile.common: * common/Makefile.common (.PHONY): Use WIN32_ANY not HAVE_MS_WINDOWS so we still link with the import library even when --with-msw=no. src/ChangeLog addition: 2010-01-16 Ben Wing <ben@xemacs.org> * win32.c (mswindows_read_link_1): Conditionalize COM support on HAVE_MS_WINDOWS because otherwise we haven't linked with the appropriate libraries.
author Ben Wing <ben@xemacs.org>
date Sat, 16 Jan 2010 06:50:01 -0600
parents b3ea9c582280
children 19a72041c5ed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* sysdll.c --- system dependent support for dynamic linked libraries
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1998 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Author: William Perry <wmperry@aventail.com>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to the Free
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 #ifdef HAVE_CONFIG_H
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
26 #include <stdlib.h>
1272
df61d2b1d4c3 [xemacs-hg @ 2003-02-07 21:40:22 by james]
james
parents: 880
diff changeset
27 #include "lisp.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include "sysdll.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
30 #ifdef DLSYM_NEEDS_UNDERSCORE
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
31 #define MAYBE_PREPEND_UNDERSCORE(n) do { \
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
32 CIbyte *buf = alloca_array (CIbyte, strlen (n) + 2); \
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
33 *buf = '_'; \
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
34 strcpy (buf + 1, n); \
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
35 n = buf; \
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
36 } while (0)
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
37 #else
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
38 #define MAYBE_PREPEND_UNDERSCORE(n)
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
39 #endif
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
40
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 /* This whole file is conditional upon HAVE_SHLIB */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 #ifdef HAVE_SHLIB
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 /* Thankfully, most systems follow the ELFish dlopen() method.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 */
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 442
diff changeset
46 #if defined(HAVE_DLOPEN)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 #include <dlfcn.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 #ifndef RTLD_LAZY
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
50 # ifdef DL_LAZY
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
51 # define RTLD_LAZY DL_LAZY
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
52 # else
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
53 # define RTLD_LAZY 1
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
54 # endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 #endif /* RTLD_LAZY isn't defined under FreeBSD - ick */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 452
diff changeset
57 #ifndef RTLD_NOW
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
58 # ifdef DL_NOW
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
59 # define RTLD_NOW DL_NOW
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
60 # else
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
61 # define RTLD_NOW 2
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
62 # endif
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 452
diff changeset
63 #endif
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 452
diff changeset
64
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 dll_handle
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
66 dll_open (Lisp_Object fname)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
68 Extbyte *soname;
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
69
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
70 if (NILP (fname))
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
71 {
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
72 soname = NULL;
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
73 }
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
74 else
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
75 {
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
76 LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding);
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
77 }
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
78 return (dll_handle) dlopen (soname, RTLD_NOW);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 dll_close (dll_handle h)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
84 return dlclose ((void *) h);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 dll_func
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
88 dll_function (dll_handle h, const CIbyte *n)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 {
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
90 MAYBE_PREPEND_UNDERSCORE (n);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
91 return (dll_func) dlsym ((void *) h, n);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 dll_var
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
95 dll_variable (dll_handle h, const CIbyte *n)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 {
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
97 MAYBE_PREPEND_UNDERSCORE (n);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 return (dll_var)dlsym ((void *)h, n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
101 Lisp_Object
1811
3fe1a35b705d [xemacs-hg @ 2003-11-29 22:11:47 by james]
james
parents: 1706
diff changeset
102 dll_error ()
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
104 const Extbyte *msg;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 #if defined(HAVE_DLERROR) || defined(dlerror)
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
106 msg = (const Extbyte *) dlerror ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 #elif defined(HAVE__DLERROR)
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
108 msg = (const Extbyte *) _dlerror();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 #else
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
110 msg = (const Extbyte *) "Shared library error";
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 #endif
4834
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 3841
diff changeset
112 return build_ext_string (msg, Qerror_message_encoding);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 #elif defined(HAVE_SHL_LOAD)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 /* This is the HP/UX version */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 #include <dl.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 dll_handle
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
119 dll_open (Lisp_Object fname)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
121 Extbyte *soname;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
123 if (NILP (fname))
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
124 {
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
125 soname = NULL;
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
126 }
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
127 else
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
128 {
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
129 LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding);
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
130 }
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
131 return (dll_handle) shl_load (soname, BIND_DEFERRED, 0L);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 dll_close (dll_handle h)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
137 return shl_unload ((shl_t) h);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 dll_func
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
141 dll_function (dll_handle h, const CIbyte *n)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 long handle = 0L;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
145 if (shl_findsym ((shl_t *) &h, n, TYPE_PROCEDURE, &handle))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
148 return (dll_func) handle;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 dll_var
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
152 dll_variable (dll_handle h, const CIbyte *n)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 long handle = 0L;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
156 if (shl_findsym ((shl_t *) &h, n, TYPE_DATA, &handle))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
159 return (dll_var) handle;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
162 Lisp_Object
1811
3fe1a35b705d [xemacs-hg @ 2003-11-29 22:11:47 by james]
james
parents: 1706
diff changeset
163 dll_error ()
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 /* #### WTF?! Shouldn't this at least attempt to get strerror or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 something? --hniksic */
4834
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 3841
diff changeset
167 return build_string ("Generic shared library error",
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 3841
diff changeset
168 Qerror_message_encoding);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
1632
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1596
diff changeset
171 #elif defined (WIN32_NATIVE) || defined (CYGWIN)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
172
1632
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1596
diff changeset
173 #include "syswindows.h"
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1596
diff changeset
174 #include "sysfile.h"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
175
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 dll_handle
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
177 dll_open (Lisp_Object fname)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
179 Extbyte *soname;
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
180
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
181 if (NILP (fname))
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
182 {
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
183 soname = NULL;
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
184 }
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
185 else
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
186 {
4834
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 3841
diff changeset
187 LISP_LOCAL_FILE_FORMAT_TO_TSTR (fname, soname);
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
188 }
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
189 return (dll_handle) qxeLoadLibrary (soname);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 dll_close (dll_handle h)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
195 return FreeLibrary ((HMODULE) h);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 dll_func
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
199 dll_function (dll_handle h, const CIbyte *n)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
201 return (dll_func) GetProcAddress ((HINSTANCE) h, n);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 dll_func
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
205 dll_variable (dll_handle h, const CIbyte *n)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
207 return (dll_func) GetProcAddress ((HINSTANCE) h, n);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
210 Lisp_Object
1811
3fe1a35b705d [xemacs-hg @ 2003-11-29 22:11:47 by james]
james
parents: 1706
diff changeset
211 dll_error ()
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
213 CIbyte err[32];
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
214 snprintf (err, 32, "Windows DLL Error %lu", GetLastError ());
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
215 return build_string (err);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 }
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
217 #elif defined(HAVE_DYLD)
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
218 /* This section supports MacOSX dynamic libraries. Dynamically
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
219 loadable libraries must be compiled as bundles, not dynamiclibs.
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
220 */
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
221
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
222 #include <mach-o/dyld.h>
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
223
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
224 dll_handle
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
225 dll_open (Lisp_Object fname)
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
226 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
227 Extbyte *soname;
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
228 NSObjectFileImage file;
1418
c7045d239c2b [xemacs-hg @ 2003-04-16 20:24:06 by james]
james
parents: 1383
diff changeset
229 NSModule out;
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
230 NSObjectFileImageReturnCode ret;
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
231
2855
612eb81b76eb [xemacs-hg @ 2005-07-12 12:22:11 by malcolmp]
malcolmp
parents: 2078
diff changeset
232 /*
612eb81b76eb [xemacs-hg @ 2005-07-12 12:22:11 by malcolmp]
malcolmp
parents: 2078
diff changeset
233 * MacOS X dll support is for bundles, not the current executable, so return
612eb81b76eb [xemacs-hg @ 2005-07-12 12:22:11 by malcolmp]
malcolmp
parents: 2078
diff changeset
234 * NULL is this case. However, dll_function() uses a special hack where a
612eb81b76eb [xemacs-hg @ 2005-07-12 12:22:11 by malcolmp]
malcolmp
parents: 2078
diff changeset
235 * NULL handle can be used to find executable symbols. This satisfies the
612eb81b76eb [xemacs-hg @ 2005-07-12 12:22:11 by malcolmp]
malcolmp
parents: 2078
diff changeset
236 * needs of ui-gtk.c but is not a general solution.
612eb81b76eb [xemacs-hg @ 2005-07-12 12:22:11 by malcolmp]
malcolmp
parents: 2078
diff changeset
237 */
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
238 if (NILP (fname))
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
239 {
2855
612eb81b76eb [xemacs-hg @ 2005-07-12 12:22:11 by malcolmp]
malcolmp
parents: 2078
diff changeset
240 return NULL;
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
241 }
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
242 else
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
243 {
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
244 LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding);
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
245 }
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
246 ret = NSCreateObjectFileImageFromFile(soname, &file);
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
247 if (ret != NSObjectFileImageSuccess) {
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
248 return NULL;
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
249 }
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
250 out = NSLinkModule(file, soname,
1418
c7045d239c2b [xemacs-hg @ 2003-04-16 20:24:06 by james]
james
parents: 1383
diff changeset
251 NSLINKMODULE_OPTION_BINDNOW |
c7045d239c2b [xemacs-hg @ 2003-04-16 20:24:06 by james]
james
parents: 1383
diff changeset
252 NSLINKMODULE_OPTION_PRIVATE |
c7045d239c2b [xemacs-hg @ 2003-04-16 20:24:06 by james]
james
parents: 1383
diff changeset
253 NSLINKMODULE_OPTION_RETURN_ON_ERROR);
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
254 return (dll_handle)out;
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
255 }
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
256
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
257 int
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
258 dll_close (dll_handle h)
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
259 {
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
260 return NSUnLinkModule((NSModule)h, NSUNLINKMODULE_OPTION_NONE);
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
261 }
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
262
1851
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
263 /* Given an address, return the mach_header for the image containing it
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
264 * or zero if the given address is not contained in any loaded images.
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
265 *
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
266 * Note: image_for_address(), my_find_image() and search_linked_libs() are
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
267 * based on code from the dlcompat library
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
268 * (http://www.opendarwin.org/projects/dlcompat).
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
269 */
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
270
3841
5989b9bbb612 [xemacs-hg @ 2007-02-22 16:19:40 by stephent]
stephent
parents: 2855
diff changeset
271 static const struct mach_header*
1851
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
272 image_for_address(void *address)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
273 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
274 unsigned long i;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
275 unsigned long count = _dyld_image_count();
3841
5989b9bbb612 [xemacs-hg @ 2007-02-22 16:19:40 by stephent]
stephent
parents: 2855
diff changeset
276 const struct mach_header *mh = 0;
1851
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
277
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
278 for (i = 0; i < count; i++)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
279 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
280 unsigned long addr = (unsigned long)address -
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
281 _dyld_get_image_vmaddr_slide(i);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
282 mh = _dyld_get_image_header(i);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
283
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
284 if (mh)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
285 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
286 struct load_command *lc =
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
287 (struct load_command *)((char *)mh + sizeof(struct mach_header));
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
288 unsigned long j;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
289
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
290 for (j = 0; j < mh->ncmds;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
291 j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
292 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
293 if (LC_SEGMENT == lc->cmd &&
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
294 addr >= ((struct segment_command *)lc)->vmaddr &&
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
295 addr <
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
296 ((struct segment_command *)lc)->vmaddr +
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
297 ((struct segment_command *)lc)->vmsize)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
298 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
299 goto image_found;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
300 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
301 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
302 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
303
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
304 mh = 0;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
305 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
306
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
307 image_found:
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
308 return mh;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
309 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
310
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
311 static const struct mach_header*
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
312 my_find_image(const char *name)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
313 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
314 const struct mach_header *mh = (struct mach_header *)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
315 NSAddImage(name, NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED |
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
316 NSADDIMAGE_OPTION_RETURN_ON_ERROR);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
317
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
318 if (!mh)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
319 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
320 int count = _dyld_image_count();
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
321 int j;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
322
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
323 for (j = 0; j < count; j++)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
324 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
325 const char *id = _dyld_get_image_name(j);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
326
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
327 if (!strcmp(id, name))
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
328 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
329 mh = _dyld_get_image_header(j);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
330 break;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
331 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
332 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
333 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
334
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
335 return mh;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
336 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
337
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
338 /*
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
339 * dyld adds libraries by first adding the directly dependant libraries in
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
340 * link order, and then adding the dependencies for those libraries, so we
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
341 * should do the same... but we don't bother adding the extra dependencies, if
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
342 * the symbols are neither in the loaded image nor any of it's direct
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
343 * dependencies, then it probably isn't there.
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
344 */
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
345 static NSSymbol
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
346 search_linked_libs(const struct mach_header * mh, const char *symbol)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
347 {
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1851
diff changeset
348 unsigned long n;
1851
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
349 NSSymbol nssym = 0;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
350
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
351 struct load_command *lc =
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
352 (struct load_command *)((char *)mh + sizeof(struct mach_header));
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
353
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
354 for (n = 0; n < mh->ncmds;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
355 n++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
356 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
357 if ((LC_LOAD_DYLIB == lc->cmd) || (LC_LOAD_WEAK_DYLIB == lc->cmd))
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
358 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
359 struct mach_header *wh;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
360
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
361 if ((wh = (struct mach_header *)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
362 my_find_image((char *)(((struct dylib_command *)lc)->dylib.name.offset +
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
363 (char *)lc))))
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
364 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
365 if (NSIsSymbolNameDefinedInImage(wh, symbol))
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
366 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
367 nssym =
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
368 NSLookupSymbolInImage(wh,
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
369 symbol,
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
370 NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
371 NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
372 break;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
373 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
374 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
375 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
376 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
377
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
378 return nssym;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
379 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
380
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
381 dll_func
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
382 dll_function (dll_handle h, const CIbyte *n)
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
383 {
1851
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
384 NSSymbol sym = 0;
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
385 MAYBE_PREPEND_UNDERSCORE (n);
1851
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
386
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
387 /* NULL means the program image and shared libraries, not bundles. */
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
388
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
389 if (h == NULL)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
390 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
391 /* NOTE: This assumes that this function is included in the main program
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
392 and not in a shared library. */
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1851
diff changeset
393 const struct mach_header* my_mh = image_for_address((void*) &dll_function);
1851
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
394
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
395 if (NSIsSymbolNameDefinedInImage(my_mh, n))
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
396 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
397 sym =
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
398 NSLookupSymbolInImage(my_mh,
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
399 n,
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
400 NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
401 NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
402 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
403
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
404 if (!sym)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
405 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
406 sym = search_linked_libs(my_mh, n);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
407 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
408 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
409 else
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
410 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
411 sym = NSLookupSymbolInModule((NSModule)h, n);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
412 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
413
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
414 if (sym == 0) return 0;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
415 return (dll_func)NSAddressOfSymbol(sym);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
416 }
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
417
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
418 dll_var
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
419 dll_variable (dll_handle h, const CIbyte *n)
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
420 {
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
421 NSSymbol sym;
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
422 MAYBE_PREPEND_UNDERSCORE (n);
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
423 sym = NSLookupSymbolInModule((NSModule)h, n);
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
424 if (sym == 0) return 0;
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
425 return (dll_var)NSAddressOfSymbol(sym);
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
426 }
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
427
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
428 Lisp_Object
1811
3fe1a35b705d [xemacs-hg @ 2003-11-29 22:11:47 by james]
james
parents: 1706
diff changeset
429 dll_error ()
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
430 {
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
431 NSLinkEditErrors c;
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
432 int errorNumber;
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
433 const CIbyte *fileNameWithError, *errorString;
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
434 NSLinkEditError(&c, &errorNumber, &fileNameWithError, &errorString);
4834
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 3841
diff changeset
435 return build_ext_string (errorString, Qerror_message_encoding);
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
436 }
2078
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
437 #elif HAVE_LTDL
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
438 /* Libtool's libltdl */
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
439 #include <ltdl.h>
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
440
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
441 dll_handle
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
442 dll_open (Lisp_Object fname)
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
443 {
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
444 Extbyte *soname;
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
445
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
446 if (NILP (fname))
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
447 {
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
448 soname = NULL;
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
449 }
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
450 else
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
451 {
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
452 LISP_STRING_TO_EXTERNAL (fname, soname, Qdll_filename_encoding);
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
453 }
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
454 return (dll_handle) lt_dlopen (soname);
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
455 }
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
456
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
457 int
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
458 dll_close (dll_handle h)
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
459 {
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
460 return lt_dlclose ((lt_dlhandle) h);
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
461 }
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
462
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
463 dll_func
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
464 dll_function (dll_handle h, const CIbyte *n)
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
465 {
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
466 MAYBE_PREPEND_UNDERSCORE (n);
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
467 return (dll_func) lt_dlsym ((lt_dlhandle) h, n);
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
468 }
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
469
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
470 dll_var
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
471 dll_variable (dll_handle h, const CIbyte *n)
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
472 {
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
473 MAYBE_PREPEND_UNDERSCORE (n);
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
474 return (dll_var) lt_dlsym ((lt_dlhandle) h, n);
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
475 }
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
476
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
477 Lisp_Object
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
478 dll_error ()
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
479 {
4834
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 3841
diff changeset
480 return build_ext_string (lt_dlerror (), Qerror_message_encoding);
2078
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
481 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 #else
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
483 /* Catchall if we don't know about this system's method of dynamic loading */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 dll_handle
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
485 dll_open (Lisp_Object fname)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 dll_close (dll_handle h)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 dll_func
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
497 dll_function (dll_handle h, const CIbyte *n)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 dll_func
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
503 dll_variable (dll_handle h, const CIbyte *n)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
508 Lisp_Object
1811
3fe1a35b705d [xemacs-hg @ 2003-11-29 22:11:47 by james]
james
parents: 1706
diff changeset
509 dll_error ()
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
511 return build_string ("Shared libraries not implemented on this system");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 #endif /* System conditionals */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 #endif /* HAVE_SHLIB */