Re: validity of foreign functions across saved image s
"Hoehle, Joerg-Cyril" <[email protected]> Fri, 29 Nov 2002 10:35:15 +0100
| Newsgroups | gmane.lisp.uffi.general |
|---|---|
| Message-ID | <[email protected]> |
Kevin Rosenberg wrote: >AllegroCL dumplisp.htm documentation file: >17.0 How the dumped image finds loaded library files > >Foreign loading is done on Unix by `loading' .so or .sl files with >dlopen() or an equivalent and on Windows by loading .dll files. Dumped >images must find these files when it starts up. Interesting. This is what the CLISP-FFI has been doing for the Amiga for years (Bruno Haible implemented it this way), but I didn't like the "on startup" feature. The reason is that some shared libraries may not be available on startup and require user interaction, e.g. the Amiga bsdsocket.library: the user has first to start the TCP/IP stack. Similarly, I believe one must start winsock on MS-Windows: it need not be there right from the start: opening would fail before that. What happens if Allegro cannot find that library? CLISP's FFI on Amiga would error out, which is IMHO not acceptable. >"Unloading all .so files and reloading them upon startup. In this >example, we unload the (in our case single) .so file with >ff:unload-foreign-library and show how to modify >*restart-init-function* so the .so file is reloaded." And ff:load-foreign-library makes all old function pointers valid again? Are they scanning the shared object for names? Or do they remember all functions from this library and revalidate, e.g. maintain a table of functions objects and dlsym() each in turn, after reopening the library? I can't believe so, since a symbol found via dlsym() need not necessarily be in the library opened via dlopen() - depending on flags. E.g., I believe Allegro UFFI users don't supply :module most of the time: I suspect Allegro to look for the symbol in any currently opened library. >Sure. I know that you were working on dynamic loading of shared >libraries during a single session. Have you finished tha, and now you >are working on doing this across saved images? It's not finished nor released. I guess I'm too much of a "better is worse" guy. I want to have some idea about how to do FF across images before I throw in something which could not cope. I've yet to live more with increments. Regards, Jorg Hohle.