1 |
|
2003-08-11 Gary V. Vaughan <gary@gnu.org> |
2 |
|
|
3 |
|
Libltdl already has an excellent mechanism for accessing C symbols |
4 |
|
in modules. Lets use that! Remove all the exporting cruft and |
5 |
|
just use lt_dlsym in conjunction with a few conventions to |
6 |
|
simplify module writers' jobs. Also removed the table address |
7 |
|
caching code and otherwise simplified the module loader quite a |
8 |
|
bit. To access exported symbols in other modules, first the |
9 |
|
exporting module must name the symbols <modname>_LTX_<symname>, |
10 |
|
and the importing module must define a function type called |
11 |
|
<symname>_func. The importer then adds |
12 |
|
M4_MODULE_IMPORT(<modname>, <symname>) at the top of any function |
13 |
|
that wishes to call out to the exported functions. Care must be |
14 |
|
taken that <symname> is non-NULL in the importing module incase |
15 |
|
M4_MODULE_IMPORT fails, but otherwise it can be called as if the |
16 |
|
definition was in the importers source. Study |
17 |
|
`modules/{gnu.c,m4.{c,h}' for a model example. At the moment, |
18 |
|
m4_module_import will attempt to automatically load a module |
19 |
|
required for symbol access if it is not loaded already. |
20 |
|
|
21 |
|
* TODO: Removed the items fixed in this delta. |
22 |
|
* m4/ltdl.c (lt_dlhandle_find): New function to find a handle by |
23 |
|
module name. |
24 |
|
* m4/ltdl.h (lt_dlhandle_find): Declare it. |
25 |
|
* m4/module.c (m4_module_unload): Use it. |
26 |
|
* src/freeze.c (reload_frozen_state): Ditto. |
27 |
|
* m4/m4module.h (m4_export): Deleted. Removed all references. |
28 |
|
(M4_MODULE_IMPORT): New user convenience macro for importing |
29 |
|
arbitrary symbols from other modules. |
30 |
|
* m4/module.c (m4_module_import): New function to service |
31 |
|
M4_MODULE_IMPORT macro. |
32 |
|
(module_data): Removed. Looking up the tables on demand with |
33 |
|
lt_dlsym, rather than caching their addresses here simplifies the |
34 |
|
code substantially. |
35 |
|
(m4_get_module_builtin_table, m4_get_module_macro_table): |
36 |
|
Removed. Changed all callers. |
37 |
|
(set_module_macro_table, set_module_builtin_table): Renamed to |
38 |
|
install_macro_table and install_builtin_table respectively, and |
39 |
|
simplified now that the cache is no more. |
40 |
|
* modules/gnu.c (builtin_symbols): Use this new mechanism to |
41 |
|
import m4_dump_symbols from the m4 module. |
42 |
|
(builtin_esyscmd): Likewise for m4_set_sysval and |
43 |
|
m4_sysval_flush. |
44 |
|
* modules/m4.c (m4_export_table): Removed. Functions are |
45 |
|
addressed with the new mechanism which doesn't need this. |
46 |
|
(m4_set_sysval): New exported accessor function to prevent |
47 |
|
problems with variable access on inferior architectures. |
48 |
|
* modules/m4.h (m4_sysval_flush_func, m4_set_sysval_func) |
49 |
|
(m4_dump_symbols_func): Typedefs required by M4_MODULE_IMPORT so |
50 |
|
that we can have some type safety. |
51 |
|
* modules/modtest.c (export_test): C level exported function for |
52 |
|
testing the new import mechanism. |
53 |
|
* modules/import.c: New file for the import end of the test. |
54 |
|
* modules/Makefile.am (pkglibexec_LTLIBRARIES): Added import.la. |
55 |
|
* tests/modules.at: New test cases for intermodule symbol |
56 |
|
importing. |
57 |
|
|
58 |
2003-08-07 Gary V. Vaughan <gary@gnu.org> |
2003-08-07 Gary V. Vaughan <gary@gnu.org> |
59 |
|
|
60 |
* m4/m4module.c (m4_string): Moved from here... |
* m4/m4module.c (m4_string): Moved from here... |