annotate src/sysdll.c @ 2227:8e7b4a0c1a81

[xemacs-hg @ 2004-08-21 17:05:49 by michaels] 2004-08-15 Jan Rychter <jwr@xemacs.org> * window-xemacs.el (really-set-window-configuration): deal gracefully with the case when the buffer previously saved in the configuration (and that we want to switch to) has been killed. Switch to the next buffer on the buffer-list in that case.
author michaels
date Sat, 21 Aug 2004 17:05:51 +0000
parents 0bcc1e4dfd91
children 612eb81b76eb
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
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
112 return build_ext_string (msg, Qnative);
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 */
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
167 return build_string ("Generic shared library error", Qnative);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169
1632
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1596
diff changeset
170 #elif defined (WIN32_NATIVE) || defined (CYGWIN)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
171
1632
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1596
diff changeset
172 #include "syswindows.h"
64eaceca611d [xemacs-hg @ 2003-08-19 02:07:03 by james]
james
parents: 1596
diff changeset
173 #include "sysfile.h"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
174
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 dll_handle
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
176 dll_open (Lisp_Object fname)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
178 Extbyte *soname;
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
179
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
180 if (NILP (fname))
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
181 {
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
182 soname = NULL;
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
183 }
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
184 else
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
185 {
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
186 LOCAL_FILE_FORMAT_TO_TSTR (fname, soname);
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
187 }
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
188 return (dll_handle) qxeLoadLibrary (soname);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 }
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 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 dll_close (dll_handle h)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
194 return FreeLibrary ((HMODULE) h);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 }
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 dll_func
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
198 dll_function (dll_handle h, const CIbyte *n)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
200 return (dll_func) GetProcAddress ((HINSTANCE) h, n);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 }
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 dll_func
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
204 dll_variable (dll_handle h, const CIbyte *n)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
206 return (dll_func) GetProcAddress ((HINSTANCE) h, n);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
209 Lisp_Object
1811
3fe1a35b705d [xemacs-hg @ 2003-11-29 22:11:47 by james]
james
parents: 1706
diff changeset
210 dll_error ()
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
212 CIbyte err[32];
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
213 snprintf (err, 32, "Windows DLL Error %lu", GetLastError ());
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
214 return build_string (err);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 }
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
216 #elif defined(HAVE_DYLD)
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
217 /* This section supports MacOSX dynamic libraries. Dynamically
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
218 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
219 */
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 #include <mach-o/dyld.h>
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
222
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
223 dll_handle
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
224 dll_open (Lisp_Object fname)
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
225 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
226 Extbyte *soname;
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
227 NSObjectFileImage file;
1418
c7045d239c2b [xemacs-hg @ 2003-04-16 20:24:06 by james]
james
parents: 1383
diff changeset
228 NSModule out;
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
229 NSObjectFileImageReturnCode ret;
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
230
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
231 if (NILP (fname))
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
232 {
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
233 soname = NULL;
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
234 }
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
235 else
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
236 {
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
237 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
238 }
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
239 ret = NSCreateObjectFileImageFromFile(soname, &file);
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
240 if (ret != NSObjectFileImageSuccess) {
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
241 return NULL;
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
242 }
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
243 out = NSLinkModule(file, soname,
1418
c7045d239c2b [xemacs-hg @ 2003-04-16 20:24:06 by james]
james
parents: 1383
diff changeset
244 NSLINKMODULE_OPTION_BINDNOW |
c7045d239c2b [xemacs-hg @ 2003-04-16 20:24:06 by james]
james
parents: 1383
diff changeset
245 NSLINKMODULE_OPTION_PRIVATE |
c7045d239c2b [xemacs-hg @ 2003-04-16 20:24:06 by james]
james
parents: 1383
diff changeset
246 NSLINKMODULE_OPTION_RETURN_ON_ERROR);
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
247 return (dll_handle)out;
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
248 }
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
249
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
250 int
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
251 dll_close (dll_handle h)
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
252 {
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
253 return NSUnLinkModule((NSModule)h, NSUNLINKMODULE_OPTION_NONE);
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
254 }
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
255
1851
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
256 /* 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
257 * 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
258 *
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
259 * 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
260 * based on code from the dlcompat library
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
261 * (http://www.opendarwin.org/projects/dlcompat).
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
262 */
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
263
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
264 static struct mach_header*
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
265 image_for_address(void *address)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
266 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
267 unsigned long i;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
268 unsigned long count = _dyld_image_count();
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
269 struct mach_header *mh = 0;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
270
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
271 for (i = 0; i < count; i++)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
272 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
273 unsigned long addr = (unsigned long)address -
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
274 _dyld_get_image_vmaddr_slide(i);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
275 mh = _dyld_get_image_header(i);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
276
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
277 if (mh)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
278 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
279 struct load_command *lc =
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
280 (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
281 unsigned long j;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
282
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
283 for (j = 0; j < mh->ncmds;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
284 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
285 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
286 if (LC_SEGMENT == lc->cmd &&
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
287 addr >= ((struct segment_command *)lc)->vmaddr &&
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
288 addr <
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
289 ((struct segment_command *)lc)->vmaddr +
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
290 ((struct segment_command *)lc)->vmsize)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
291 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
292 goto image_found;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
293 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
294 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
295 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
296
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
297 mh = 0;
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
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
300 image_found:
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
301 return mh;
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 static const struct mach_header*
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
305 my_find_image(const char *name)
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 const struct mach_header *mh = (struct mach_header *)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
308 NSAddImage(name, NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED |
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
309 NSADDIMAGE_OPTION_RETURN_ON_ERROR);
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 if (!mh)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
312 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
313 int count = _dyld_image_count();
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
314 int j;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
315
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
316 for (j = 0; j < count; j++)
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 const char *id = _dyld_get_image_name(j);
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 if (!strcmp(id, name))
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
321 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
322 mh = _dyld_get_image_header(j);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
323 break;
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 }
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
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
328 return mh;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
329 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
330
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 * 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
333 * 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
334 * 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
335 * 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
336 * dependencies, then it probably isn't there.
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 static NSSymbol
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
339 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
340 {
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1851
diff changeset
341 unsigned long n;
1851
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
342 NSSymbol nssym = 0;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
343
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
344 struct load_command *lc =
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
345 (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
346
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
347 for (n = 0; n < mh->ncmds;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
348 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
349 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
350 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
351 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
352 struct mach_header *wh;
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 if ((wh = (struct mach_header *)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
355 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
356 (char *)lc))))
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
357 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
358 if (NSIsSymbolNameDefinedInImage(wh, symbol))
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
359 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
360 nssym =
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
361 NSLookupSymbolInImage(wh,
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
362 symbol,
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
363 NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
364 NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
365 break;
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 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
368 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
369 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
370
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
371 return nssym;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
372 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
373
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
374 dll_func
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
375 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
376 {
1851
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
377 NSSymbol sym = 0;
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
378 MAYBE_PREPEND_UNDERSCORE (n);
1851
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 /* 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
381
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
382 if (h == NULL)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
383 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
384 /* 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
385 and not in a shared library. */
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1851
diff changeset
386 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
387
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
388 if (NSIsSymbolNameDefinedInImage(my_mh, n))
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
389 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
390 sym =
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
391 NSLookupSymbolInImage(my_mh,
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
392 n,
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
393 NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
394 NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
395 }
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 if (!sym)
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
398 {
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
399 sym = search_linked_libs(my_mh, n);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
400 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
401 }
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
402 else
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 sym = NSLookupSymbolInModule((NSModule)h, n);
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
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
407 if (sym == 0) return 0;
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
408 return (dll_func)NSAddressOfSymbol(sym);
7fdde2d3ae5f [xemacs-hg @ 2004-01-03 23:06:49 by james]
james
parents: 1811
diff changeset
409 }
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
410
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
411 dll_var
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
412 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
413 {
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
414 NSSymbol sym;
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
415 MAYBE_PREPEND_UNDERSCORE (n);
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
416 sym = NSLookupSymbolInModule((NSModule)h, n);
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
417 if (sym == 0) return 0;
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
418 return (dll_var)NSAddressOfSymbol(sym);
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
419 }
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
420
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
421 Lisp_Object
1811
3fe1a35b705d [xemacs-hg @ 2003-11-29 22:11:47 by james]
james
parents: 1706
diff changeset
422 dll_error ()
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
423 {
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
424 NSLinkEditErrors c;
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
425 int errorNumber;
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
426 const CIbyte *fileNameWithError, *errorString;
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
427 NSLinkEditError(&c, &errorNumber, &fileNameWithError, &errorString);
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
428 return build_ext_string (errorString, Qnative);
1383
517919955e3f [xemacs-hg @ 2003-03-26 04:22:47 by james]
james
parents: 1272
diff changeset
429 }
2078
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
430 #elif HAVE_LTDL
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
431 /* Libtool's libltdl */
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
432 #include <ltdl.h>
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
433
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
434 dll_handle
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
435 dll_open (Lisp_Object fname)
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
436 {
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
437 Extbyte *soname;
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
438
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
439 if (NILP (fname))
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 soname = NULL;
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
442 }
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
443 else
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
444 {
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
445 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
446 }
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
447 return (dll_handle) lt_dlopen (soname);
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
448 }
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 int
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
451 dll_close (dll_handle h)
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
452 {
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
453 return lt_dlclose ((lt_dlhandle) h);
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
454 }
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 dll_func
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
457 dll_function (dll_handle h, const CIbyte *n)
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
458 {
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
459 MAYBE_PREPEND_UNDERSCORE (n);
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
460 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
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_var
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
464 dll_variable (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_var) 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 Lisp_Object
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
471 dll_error ()
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 return build_ext_string (lt_dlerror (), Qnative);
0bcc1e4dfd91 [xemacs-hg @ 2004-05-14 15:34:36 by james]
james
parents: 2054
diff changeset
474 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 #else
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
476 /* 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
477 dll_handle
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
478 dll_open (Lisp_Object fname)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 dll_close (dll_handle h)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 }
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 dll_func
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
490 dll_function (dll_handle h, const CIbyte *n)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 }
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 dll_func
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
496 dll_variable (dll_handle h, const CIbyte *n)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
501 Lisp_Object
1811
3fe1a35b705d [xemacs-hg @ 2003-11-29 22:11:47 by james]
james
parents: 1706
diff changeset
502 dll_error ()
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 {
1706
9fc738581a9d [xemacs-hg @ 2003-09-22 03:21:12 by james]
james
parents: 1632
diff changeset
504 return build_string ("Shared libraries not implemented on this system");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 #endif /* System conditionals */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 #endif /* HAVE_SHLIB */