[off-topic] Loadable modules

Brian Candler (B.Candler@pobox.com)
Sun, 1 Jun 1997 19:22:09 +0100 (BST)


(Please excuse a somewhat off-topic posting, but I was unable to find a
generic "linux developers" list)

The kernel has the ability to dynamically load and run object files (xxx.o)
and I want to know if this is possible from normal "userland" programs.

e.g. let's say I have a bunch of object files in a directory. I want to
write a C program which loads them all in, perhaps malloc's stack and BSS
space for them, and runs them. Is this possible?

I know I could exec() regular binaries, but if I want to run 20 such
'objects' together this would mean 20 slots in the process table. I also
know I can use Java to do this, but I would like to know if there is a
lower-level (more efficient) solution. If it's not possible in C, are there
other languages (e.g. Objective C) that have this capability?

FYI, the application is a pluggable configuration system for Linux, whose
planned architecture is like this:

Database <--------> Linnet Daemon <-------> Front end
^ ^
| |
v |
Configuration modules Database
("middleware") descriptors
|
|
v
Config files

The 'middleware' will be a set of small programs whose main function is to
take chunks of the configuration database and write /etc/xxx.conf files. The
core daemon needs to be able to dynamically load and run them as required,
so the user can add new packages (and hence new configuration modules)
without relinking the daemon itself.

Thanks in advance,

Brian Candler.