(question) Loading/unloading C functions at runtime
D. Hugh Redelmeier
hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org
Tue Nov 22 15:50:58 UTC 2011
| From: William Park <opengeometry-FFYn/CNdgSA at public.gmane.org>
| Do you know any C application where you load and unload C functions
| at runtime? The only thing that comes to my mind is Bash shell, where
| you can load/unload builtin functions (within *.so file) written by user.
| I'm interested in looking at other applications and see how they do it.
Anything called a "plugin" is likely an example. Browsers do this.
The dynamic loader supports this kind of thing (i.e. *.so files). I
don't know if unloading is supported.
Think of Linux kernel modules.
Other hacks are possible but are a lot of work and are fragile.
Various things are using LLVM to generate on-the-fly code. Think of
GIT compiling.
The low performance way is to run a sub-process (eg. the system(3)
function).
More information about the Legacy
mailing list