428
|
1 /* emodules.c - Support routines for dynamic module loading
|
|
2 (C) Copyright 1998, 1999 J. Kean Johnston. All rights reserved.
|
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 #include "emodules.h"
|
|
22 #include "sysdll.h"
|
|
23
|
|
24 #ifdef HAVE_SHLIB
|
|
25
|
|
26 /* CE-Emacs version number */
|
|
27 Lisp_Object Vmodule_version;
|
|
28
|
|
29 /* Do we do our work quietly? */
|
|
30 int load_modules_quietly;
|
|
31
|
|
32 /* Load path */
|
|
33 Lisp_Object Vmodule_load_path;
|
|
34
|
564
|
35 Lisp_Object Qdll_error;
|
|
36
|
428
|
37 typedef struct _emodules_list
|
|
38 {
|
|
39 int used; /* Is this slot used? */
|
|
40 char *soname; /* Name of the shared object loaded (full path) */
|
|
41 char *modname; /* The name of the module */
|
|
42 char *modver; /* The version that the module is at */
|
|
43 char *modtitle; /* How the module announces itself */
|
|
44 dll_handle dlhandle; /* Dynamic lib handle */
|
|
45 } emodules_list;
|
|
46
|
|
47 static Lisp_Object Vmodule_extensions;
|
|
48
|
|
49 static int emodules_depth;
|
|
50 static dll_handle dlhandle;
|
|
51 static emodules_list *modules;
|
|
52 static int modnum;
|
|
53
|
442
|
54 static int find_make_module (const char *mod, const char *name, const char *ver, int make_or_find);
|
428
|
55 static Lisp_Object module_load_unwind (Lisp_Object);
|
|
56 static void attempt_module_delete (int mod);
|
|
57
|
|
58 DEFUN ("load-module", Fload_module, 1, 3, "FLoad dynamic module: ", /*
|
|
59 Load in a C Emacs Extension module named FILE.
|
|
60 The optional NAME and VERSION are used to identify specific modules.
|
|
61
|
|
62 This function is similar in intent to `load' except that it loads in
|
|
63 pre-compiled C or C++ code, using dynamic shared objects. If NAME is
|
|
64 specified, then the module is only loaded if its internal name matches
|
|
65 the NAME specified. If VERSION is specified, then the module is only
|
|
66 loaded if it matches that VERSION. This function will check to make
|
|
67 sure that the same module is not loaded twice. Modules are searched
|
|
68 for in the same way as Lisp files, except that the valid file
|
|
69 extensions are `.so', `.dll' or `.ell'.
|
|
70
|
|
71 All symbols in the shared module must be completely resolved in order
|
|
72 for this function to be successful. Any modules which the specified
|
|
73 FILE depends on will be automatically loaded. You can determine which
|
|
74 modules have been loaded as dynamic shared objects by examining the
|
|
75 return value of the function `list-modules'.
|
|
76
|
|
77 It is possible, although unwise, to unload modules using `unload-module'.
|
442
|
78 The preferred mechanism for unloading or reloading modules is to quit
|
428
|
79 XEmacs, and then reload those new or changed modules that are required.
|
|
80
|
|
81 Messages informing you of the progress of the load are displayed unless
|
|
82 the variable `load-modules-quietly' is non-NIL.
|
|
83 */
|
444
|
84 (file, name, version))
|
428
|
85 {
|
|
86 char *mod, *mname, *mver;
|
|
87 int speccount = specpdl_depth();
|
|
88
|
|
89 CHECK_STRING(file);
|
|
90
|
|
91 mod = (char *)XSTRING_DATA (file);
|
|
92
|
|
93 if (NILP (name))
|
|
94 mname = "";
|
|
95 else
|
|
96 mname = (char *)XSTRING_DATA (name);
|
|
97
|
|
98 if (NILP (version))
|
|
99 mver = "";
|
|
100 else
|
|
101 mver = (char *)XSTRING_DATA (version);
|
|
102
|
|
103 dlhandle = 0;
|
|
104 record_unwind_protect (module_load_unwind, make_int(modnum));
|
|
105 emodules_load (mod, mname, mver);
|
771
|
106 unbind_to (speccount);
|
428
|
107
|
|
108 return Qt;
|
|
109 }
|
|
110
|
|
111 #ifdef DANGEROUS_NASTY_SCARY_MONSTER
|
|
112
|
|
113 DEFUN ("unload-module", Fmodule_unload, 1, 3, 0, /*
|
|
114 Unload a module previously loaded with load-module.
|
|
115
|
|
116 As with load-module, this function requires at least the module FILE, and
|
|
117 optionally the module NAME and VERSION to unload. It may not be possible
|
|
118 for the module to be unloaded from memory, as there may be Lisp objects
|
442
|
119 referring to variables inside the module code. However, once you have
|
428
|
120 requested a module to be unloaded, it will be unloaded from memory as
|
|
121 soon as the last reference to symbols within the module is destroyed.
|
|
122 */
|
444
|
123 (file, name, version))
|
428
|
124 {
|
|
125 int x;
|
|
126 char *mod, *mname, *mver;
|
|
127
|
|
128 CHECK_STRING(file);
|
|
129
|
|
130 mod = (char *)XSTRING_DATA (file);
|
|
131
|
|
132 if (NILP (name))
|
|
133 mname = "";
|
|
134 else
|
|
135 mname = (char *)XSTRING_DATA (name);
|
|
136
|
|
137 if (NILP (version))
|
|
138 mver = "";
|
|
139 else
|
|
140 mver = (char *)XSTRING_DATA (version);
|
|
141
|
|
142 x = find_make_module (mod, mname, mver, 1);
|
|
143 if (x != -1)
|
|
144 attempt_module_delete (x);
|
|
145 return Qt;
|
|
146 }
|
|
147 #endif /* DANGEROUS_NASTY_SCARY_MONSTER */
|
|
148
|
|
149 DEFUN ("list-modules", Flist_modules, 0, 0, "", /*
|
|
150 Produce a list of loaded dynamic modules.
|
|
151
|
|
152 This function will return a list of all the loaded dynamic modules.
|
|
153 Each element in the list is a list in the form (SONAME NAME VER DESC),
|
|
154 where SONAME is the name of the shared object that was loaded, NAME
|
|
155 is the internal module name, VER is the version of the module, and DESC
|
|
156 is how the module describes itself.
|
|
157
|
|
158 This function returns a list, so you will need to assign the return value
|
|
159 to a variable and then examine the variable with `describe-variable'.
|
|
160 For example:
|
|
161
|
|
162 (setq mylist (list-modules))
|
|
163 (describe-variable 'mylist)
|
|
164
|
|
165
|
|
166 NOTE: It is possible for the same module to be loaded more than once,
|
|
167 at different versions. However, you should never see the same module,
|
|
168 with the same name and version, loaded more than once. If you do, this
|
|
169 is a bug, and you are encouraged to report it.
|
|
170 */
|
|
171 ())
|
|
172 {
|
|
173 Lisp_Object mlist = Qnil;
|
|
174 int i;
|
|
175
|
|
176 for (i = 0; i < modnum; i++)
|
|
177 {
|
|
178 if (modules[i].used == 1)
|
|
179 mlist = Fcons (list4 (build_string (modules[i].soname),
|
|
180 build_string (modules[i].modname),
|
|
181 build_string (modules[i].modver),
|
|
182 build_string (modules[i].modtitle)), mlist);
|
|
183 }
|
|
184
|
|
185 return mlist;
|
|
186 }
|
|
187
|
|
188 static int
|
442
|
189 find_make_module (const char *mod, const char *name, const char *ver, int mof)
|
428
|
190 {
|
|
191 int i, fs = -1;
|
|
192
|
|
193 for (i = 0; i < modnum; i++)
|
|
194 {
|
|
195 if (fs == -1 && modules[i].used == 0)
|
|
196 fs = i;
|
|
197 if (strcmp (modules[i].soname, mod) == 0)
|
|
198 {
|
|
199 if (name && name[0] && strcmp (modules[i].modname, name))
|
|
200 continue;
|
|
201 if (ver && ver[0] && strcmp (modules[i].modver, ver))
|
|
202 continue;
|
|
203 return i; /* Found a match */
|
|
204 }
|
|
205 }
|
|
206
|
|
207 if (mof)
|
|
208 return fs;
|
|
209
|
|
210 if (fs != -1)
|
|
211 return fs; /* First free slot */
|
|
212
|
|
213 /*
|
442
|
214 * We only get here if we haven't found a free slot and the module was
|
428
|
215 * not previously loaded.
|
|
216 */
|
|
217 if (modules == (emodules_list *)0)
|
440
|
218 modules = (emodules_list *) xmalloc (sizeof (emodules_list));
|
428
|
219 modnum++;
|
440
|
220 modules = (emodules_list *) xrealloc (modules, modnum * sizeof (emodules_list));
|
428
|
221
|
|
222 fs = modnum - 1;
|
|
223 memset (&modules[fs], 0, sizeof(emodules_list));
|
|
224 return fs;
|
|
225 }
|
|
226
|
|
227 static void
|
|
228 attempt_module_delete (int mod)
|
|
229 {
|
|
230 if (dll_close (modules[mod].dlhandle) == 0)
|
|
231 {
|
|
232 xfree (modules[mod].soname);
|
|
233 xfree (modules[mod].modname);
|
|
234 xfree (modules[mod].modver);
|
|
235 xfree (modules[mod].modtitle);
|
|
236 modules[mod].dlhandle = 0;
|
|
237 modules[mod].used = 0;
|
|
238 }
|
|
239 else if (modules[mod].used > 1)
|
|
240 modules[mod].used = 1; /* We couldn't delete it - it stays */
|
|
241 }
|
|
242
|
|
243 static Lisp_Object
|
|
244 module_load_unwind (Lisp_Object upto)
|
|
245 {
|
|
246 int x,l=0;
|
|
247
|
|
248 /*
|
|
249 * First close off the current handle if it is open.
|
|
250 */
|
|
251 if (dlhandle != 0)
|
|
252 dll_close (dlhandle);
|
|
253 dlhandle = 0;
|
|
254
|
|
255 if (CONSP (upto))
|
|
256 {
|
|
257 if (INTP (XCAR (upto)))
|
|
258 l = XINT (XCAR (upto));
|
853
|
259 free_cons (upto);
|
428
|
260 }
|
|
261 else
|
|
262 l = XINT (upto);
|
|
263
|
|
264 /*
|
|
265 * Here we need to go through and dlclose() (IN REVERSE ORDER!) any
|
|
266 * modules that were loaded as part of this load chain. We only mark
|
|
267 * the slots as closed if the dlclose() succeeds.
|
|
268 */
|
|
269 for (x = modnum-1; x >= l; x--)
|
|
270 {
|
|
271 if (modules[x].used > 1)
|
|
272 attempt_module_delete (x);
|
|
273 }
|
|
274 emodules_depth = 0;
|
|
275
|
|
276 return Qnil;
|
|
277 }
|
|
278
|
|
279 /*
|
|
280 * Do the actual grunt-work of loading in a module. We first try and
|
|
281 * dlopen() the module. If that fails, we have an error and we bail
|
|
282 * out immediately. If the dlopen() succeeds, we need to check for the
|
442
|
283 * existence of certain special symbols.
|
428
|
284 *
|
|
285 * All modules will have complete access to the variables and functions
|
|
286 * defined within XEmacs itself. It is up to the module to declare any
|
|
287 * variables or functions it uses, however. Modules will also have access
|
|
288 * to other functions and variables in other loaded modules, unless they
|
|
289 * are defined as STATIC.
|
|
290 *
|
|
291 * We need to be very careful with how we load modules. If we encounter an
|
|
292 * error along the way, we need to back out completely to the point at
|
442
|
293 * which the user started. Since we can be called recursively, we need to
|
428
|
294 * take care with marking modules as loaded. When we first start loading
|
|
295 * modules, we set the counter to zero. As we enter the function each time,
|
442
|
296 * we increment the counter, and before we leave we decrement it. When
|
428
|
297 * we get back down to 0, we know we are at the end of the chain and we
|
|
298 * can mark all the modules in the list as loaded.
|
|
299 *
|
|
300 * When we signal an error, we need to be sure to unwind all modules loaded
|
|
301 * thus far (but only for this module chain). It is assumed that if any
|
|
302 * modules in a chain fail, then they all do. This is logical, considering
|
442
|
303 * that the only time we recurse is when we have dependent modules. So in
|
428
|
304 * the error handler we take great care to close off the module chain before
|
|
305 * we call "error" and let the Fmodule_load unwind_protect() function handle
|
|
306 * the cleaning up.
|
|
307 */
|
|
308 void
|
442
|
309 emodules_load(const char *module, const char *modname, const char *modver)
|
428
|
310 {
|
|
311 Lisp_Object filename;
|
|
312 Lisp_Object foundname;
|
|
313 int fd, x, mpx;
|
|
314 char *soname, *tmod;
|
442
|
315 const char **f;
|
|
316 const long *ellcc_rev;
|
428
|
317 char *mver, *mname, *mtitle, *symname;
|
|
318 void (*modload)(void) = 0;
|
|
319 void (*modsyms)(void) = 0;
|
|
320 void (*modvars)(void) = 0;
|
|
321 void (*moddocs)(void) = 0;
|
|
322 emodules_list *mp;
|
|
323 struct gcpro gcpro1,gcpro2;
|
|
324
|
|
325 filename = Qnil;
|
|
326 foundname = Qnil;
|
|
327
|
|
328 emodules_depth++;
|
|
329 dlhandle = 0;
|
|
330
|
442
|
331 if ((module == (const char *)0) || (module[0] == '\0'))
|
563
|
332 invalid_argument ("Empty module name", Qunbound);
|
428
|
333
|
|
334 /* This is to get around the fact that build_string() is not declared
|
|
335 as taking a const char * as an argument. I HATE compiler warnings. */
|
851
|
336 tmod = (char *)ALLOCA (strlen (module) + 1);
|
428
|
337 strcpy (tmod, module);
|
|
338
|
|
339 GCPRO2(filename, foundname);
|
|
340 filename = build_string (tmod);
|
563
|
341 fd = locate_file (Vmodule_load_path, filename, Vmodule_extensions,
|
|
342 &foundname, -1);
|
428
|
343 UNGCPRO;
|
|
344
|
|
345 if (fd < 0)
|
563
|
346 signal_error (Qdll_error, "Cannot open dynamic module", filename);
|
428
|
347
|
851
|
348 soname = (char *)ALLOCA (XSTRING_LENGTH (foundname) + 1);
|
428
|
349 strcpy (soname, (char *)XSTRING_DATA (foundname));
|
|
350
|
|
351 dlhandle = dll_open (soname);
|
|
352 if (dlhandle == (dll_handle)0)
|
563
|
353 {
|
867
|
354 Ibyte *dllerrint;
|
563
|
355
|
|
356 EXTERNAL_TO_C_STRING (dll_error (dlhandle), dllerrint, Qnative);
|
|
357 signal_error (Qdll_error, "Opening dynamic module",
|
771
|
358 build_intstring (dllerrint));
|
563
|
359 }
|
428
|
360
|
442
|
361 ellcc_rev = (const long *)dll_variable (dlhandle, "emodule_compiler");
|
|
362 if ((ellcc_rev == (const long *)0) || (*ellcc_rev <= 0))
|
563
|
363 signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_compiler'", Qunbound);
|
428
|
364 if (*ellcc_rev > EMODULES_REVISION)
|
563
|
365 signal_ferror (Qdll_error, "Invalid dynamic module: Unsupported version `%ld(%ld)'", *ellcc_rev, EMODULES_REVISION);
|
428
|
366
|
442
|
367 f = (const char **)dll_variable (dlhandle, "emodule_name");
|
|
368 if ((f == (const char **)0) || (*f == (const char *)0))
|
563
|
369 signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_name'", Qunbound);
|
428
|
370
|
851
|
371 mname = (char *)ALLOCA (strlen (*f) + 1);
|
428
|
372 strcpy (mname, *f);
|
|
373 if (mname[0] == '\0')
|
563
|
374 signal_error (Qdll_error, "Invalid dynamic module: Empty value for `emodule_name'", Qunbound);
|
428
|
375
|
442
|
376 f = (const char **)dll_variable (dlhandle, "emodule_version");
|
|
377 if ((f == (const char **)0) || (*f == (const char *)0))
|
563
|
378 signal_error (Qdll_error, "Missing symbol `emodule_version': Invalid dynamic module", Qunbound);
|
428
|
379
|
851
|
380 mver = (char *)ALLOCA (strlen (*f) + 1);
|
428
|
381 strcpy (mver, *f);
|
|
382
|
442
|
383 f = (const char **)dll_variable (dlhandle, "emodule_title");
|
|
384 if ((f == (const char **)0) || (*f == (const char *)0))
|
563
|
385 signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_title'", Qunbound);
|
428
|
386
|
851
|
387 mtitle = (char *)ALLOCA (strlen (*f) + 1);
|
428
|
388 strcpy (mtitle, *f);
|
|
389
|
851
|
390 symname = (char *)ALLOCA (strlen (mname) + 15);
|
428
|
391
|
|
392 strcpy (symname, "modules_of_");
|
|
393 strcat (symname, mname);
|
|
394 modload = (void (*)(void))dll_function (dlhandle, symname);
|
|
395 /*
|
442
|
396 * modload is optional. If the module doesn't require other modules it can
|
428
|
397 * be left out.
|
|
398 */
|
|
399
|
|
400 strcpy (symname, "syms_of_");
|
|
401 strcat (symname, mname);
|
|
402 modsyms = (void (*)(void))dll_function (dlhandle, symname);
|
|
403 if (modsyms == (void (*)(void))0)
|
563
|
404 {
|
|
405 missing_symbol:
|
|
406 signal_error (Qdll_error, "Invalid dynamic module: Missing symbol",
|
|
407 build_string (symname));
|
|
408 }
|
428
|
409
|
|
410 strcpy (symname, "vars_of_");
|
|
411 strcat (symname, mname);
|
|
412 modvars = (void (*)(void))dll_function (dlhandle, symname);
|
|
413 if (modvars == (void (*)(void))0)
|
563
|
414 goto missing_symbol;
|
428
|
415
|
|
416 strcpy (symname, "docs_of_");
|
|
417 strcat (symname, mname);
|
|
418 moddocs = (void (*)(void))dll_function (dlhandle, symname);
|
|
419 if (moddocs == (void (*)(void))0)
|
563
|
420 goto missing_symbol;
|
428
|
421
|
|
422 if (modname && modname[0] && strcmp (modname, mname))
|
563
|
423 signal_error (Qdll_error, "Module name mismatch", Qunbound);
|
428
|
424
|
|
425 if (modver && modver[0] && strcmp (modver, mver))
|
563
|
426 signal_error (Qdll_error, "Module version mismatch", Qunbound);
|
428
|
427
|
|
428 /*
|
|
429 * Attempt to make a new slot for this module. If this really is the
|
|
430 * first time we are loading this module, the used member will be 0.
|
|
431 * If that is non-zero, we know that we have a previously loaded module
|
442
|
432 * of the same name and version, and we don't need to go any further.
|
428
|
433 */
|
|
434 mpx = find_make_module (soname, mname, mver, 0);
|
|
435 mp = &modules[mpx];
|
|
436 if (mp->used > 0)
|
|
437 {
|
|
438 emodules_depth--;
|
|
439 dll_close (dlhandle);
|
806
|
440 dlhandle = 0; /* Zero this out before module_load_unwind runs */
|
428
|
441 return;
|
|
442 }
|
|
443
|
|
444 if (!load_modules_quietly)
|
|
445 message ("Loading %s v%s (%s)", mname, mver, mtitle);
|
|
446
|
|
447 /*
|
|
448 * We have passed the basic initialization, and can now add this
|
|
449 * module to the list of modules.
|
|
450 */
|
|
451 mp->used = emodules_depth + 1;
|
|
452 mp->soname = xstrdup (soname);
|
|
453 mp->modname = xstrdup (mname);
|
|
454 mp->modver = xstrdup (mver);
|
|
455 mp->modtitle = xstrdup (mtitle);
|
|
456 mp->dlhandle = dlhandle;
|
|
457 dlhandle = 0;
|
|
458
|
|
459 /*
|
|
460 * Now we need to call the module init function and perform the various
|
|
461 * startup tasks.
|
|
462 */
|
|
463 if (modload != 0)
|
|
464 (*modload)();
|
|
465
|
|
466 /*
|
|
467 * Now we can get the module to initialize its symbols, and then its
|
|
468 * variables, and lastly the documentation strings.
|
|
469 */
|
|
470 (*modsyms)();
|
|
471 (*modvars)();
|
|
472 (*moddocs)();
|
|
473
|
|
474 if (!load_modules_quietly)
|
|
475 message ("Loaded module %s v%s (%s)", mname, mver, mtitle);
|
|
476
|
|
477
|
|
478 emodules_depth--;
|
|
479 if (emodules_depth == 0)
|
|
480 {
|
|
481 /*
|
|
482 * We have reached the end of the load chain. We now go through the
|
|
483 * list of loaded modules and mark all the valid modules as just
|
|
484 * that.
|
|
485 */
|
|
486 for (x = 0; x < modnum; x++)
|
|
487 if (modules[x].used > 1)
|
|
488 modules[x].used = 1;
|
|
489 }
|
|
490 }
|
|
491
|
|
492 void
|
442
|
493 emodules_doc_subr(const char *symname, const char *doc)
|
428
|
494 {
|
|
495 Bytecount len = strlen (symname);
|
867
|
496 Lisp_Object sym = oblookup (Vobarray, (const Ibyte *)symname, len);
|
440
|
497 Lisp_Subr *subr;
|
428
|
498
|
|
499 if (SYMBOLP(sym))
|
|
500 {
|
|
501 subr = XSUBR( XSYMBOL(sym)->function);
|
|
502 subr->doc = xstrdup (doc);
|
|
503 }
|
|
504 /*
|
|
505 * FIXME: I wish there was some way to avoid the xstrdup(). Is it
|
|
506 * possible to just set a pointer to the string, or somehow create a
|
|
507 * symbol whose value we can point to the constant string? Can someone
|
|
508 * look into this?
|
|
509 */
|
|
510 }
|
|
511
|
|
512 void
|
442
|
513 emodules_doc_sym (const char *symname, const char *doc)
|
428
|
514 {
|
|
515 Bytecount len = strlen (symname);
|
867
|
516 Lisp_Object sym = oblookup (Vobarray, (const Ibyte *)symname, len);
|
428
|
517 Lisp_Object docstr;
|
|
518 struct gcpro gcpro1;
|
|
519
|
|
520 if (SYMBOLP(sym))
|
|
521 {
|
|
522 docstr = build_string (doc);
|
|
523 GCPRO1(docstr);
|
|
524 Fput (sym, Qvariable_documentation, docstr);
|
|
525 UNGCPRO;
|
|
526 }
|
|
527 }
|
|
528
|
|
529
|
|
530 void
|
|
531 syms_of_module (void)
|
|
532 {
|
564
|
533 DEFERROR_STANDARD (Qdll_error, Qerror);
|
428
|
534 DEFSUBR(Fload_module);
|
|
535 DEFSUBR(Flist_modules);
|
|
536 #ifdef DANGEROUS_NASTY_SCARY_MONSTER
|
|
537 DEFSUBR(Funload_module);
|
|
538 #endif
|
|
539 }
|
|
540
|
|
541 void
|
|
542 reinit_vars_of_module (void)
|
|
543 {
|
|
544 emodules_depth = 0;
|
|
545 modules = (emodules_list *)0;
|
|
546 modnum = 0;
|
|
547 }
|
|
548
|
|
549 void
|
|
550 vars_of_module (void)
|
|
551 {
|
|
552 reinit_vars_of_module ();
|
|
553
|
|
554 DEFVAR_LISP ("module-version", &Vmodule_version /*
|
|
555 Emacs dynamic loading mechanism version, as a string.
|
|
556
|
|
557 This string is in the form XX.YY.ppp, where XX is the major version
|
|
558 number, YY is the minor version number, and ppp is the patch level.
|
442
|
559 This variable can be used to distinguish between different versions of
|
428
|
560 the dynamic loading technology used in Emacs, if required. It is not
|
|
561 a given that this value will be the same as the Emacs version number.
|
|
562 */ );
|
|
563 Vmodule_version = build_string (EMODULES_VERSION);
|
|
564
|
|
565 DEFVAR_BOOL ("load-modules-quietly", &load_modules_quietly /*
|
|
566 *Set to t if module loading is to be silent.
|
|
567
|
|
568 Normally, when loading dynamic modules, Emacs will inform you of its
|
|
569 progress, and will display the module name and version if the module
|
|
570 is loaded correctly. Setting this variable to `t' will suppress these
|
|
571 messages. This would normally only be done if `load-module' was being
|
|
572 called by a Lisp function.
|
|
573 */);
|
|
574
|
|
575 DEFVAR_LISP ("module-load-path", &Vmodule_load_path /*
|
|
576 *List of directories to search for dynamic modules to load.
|
|
577 Each element is a string (directory name) or nil (try default directory).
|
|
578
|
|
579 Note that elements of this list *may not* begin with "~", so you must
|
442
|
580 call `expand-file-name' on them before adding them to this list.
|
428
|
581
|
|
582 Initialized based on EMACSMODULEPATH environment variable, if any, otherwise
|
|
583 to default specified the file `paths.h' when XEmacs was built. If there
|
|
584 were no paths specified in `paths.h', then XEmacs chooses a default
|
|
585 value for this variable by looking around in the file-system near the
|
|
586 directory in which the XEmacs executable resides.
|
|
587
|
|
588 Due to the nature of dynamic modules, the path names should almost always
|
442
|
589 refer to architecture-dependent directories. It is unwise to attempt to
|
|
590 store dynamic modules in a heterogenous environment. Some environments
|
428
|
591 are similar enough to each other that XEmacs will be unable to determine
|
|
592 the correctness of a dynamic module, which can have unpredictable results
|
|
593 when a dynamic module is loaded.
|
|
594 */);
|
|
595
|
|
596 /* #### Export this to Lisp */
|
|
597 Vmodule_extensions = build_string (":.ell:.so:.dll");
|
|
598 staticpro (&Vmodule_extensions);
|
|
599
|
|
600 load_modules_quietly = 0;
|
|
601 Vmodule_load_path = Qnil;
|
|
602 Fprovide (intern ("modules"));
|
|
603 }
|
|
604
|
|
605 #endif /* HAVE_SHLIB */
|
|
606
|