--------------------------------------------------------------------------- Torben Bang Nielsen tbn@csd.cri.dk (query) Lately I've been playing around with loading .o files into an already running program under SunOS 4.1. I've found a set of functions (dlopen, dlsym, dlclose and dlerror) which, according to the man-page, should provide a convienient interface to the dynamic linker 'ld.so' for dynamically linking object files into a program at run-time - not load time. Basically what must be done in order to achieve this is to prepare the .o file with the '-A' option to the link editor 'ld' for run-time linking (BTW all the C files should be compiled with the -pic option, according to Sun's manual on shared libraries) When the .o file have been prepared it should simply be a matter of calling 'dlopen' from within the main program with the name of the .o file as argument. This is where it starts going wrong. I get the following error message from within the 'dlopen' function and the program exits (with status code 127): ld.so: mmap data error (22) for test.o What have I done wrong!? The .o file was 'prepared' for loading into the executable 'dynload' from a file 'test1.o' with the following command: ld -assert pure-text -o test.o -A dynload -dp -dc test1.o BTW the '-assert' didn't cause any messages. ---------------------------------------------------------------------------