[Ecls-list] problem with shared libraries

Juan Jose Garcia-Ripoll jlr at mpq.mpg.de
Mon Jul 8 01:42:04 UTC 2002


Hi,

I have looked at your code and it compiles ok with the latest CVS source code. 
In my system ECL (not ECLS) is installed using --prefix=$HOME. The sequence I 
used to build and compile your program is:

1°) Type the routine sad.c

#include <ecl.h>
#include <string.h>

void _inita() {
        int argc = 1;
        char * argv[2] = { "/home/bah/perl/ecls/a.out", NULL };
        printf("hello, i start booting\n");
        cl_boot(argc,argv);
        printf("end boot\n");
}

2°) Compile the shared library

gcc -I$HOME/lib/ecl/h -c sad.c
gcc -nostdlib -shared -L$HOME/lib/ecl sad.o -o sad.so -lecl -lclos -llsp -lgmp 
-lgc -ldl -lgmp -lm

3°) Type the test program

#include <dlfcn.h>

int main() {
        void *h = dlopen ("./sad.so", RTLD_NOW | RTLD_GLOBAL);
        void (*boota)() = dlsym(h, "_inita");
        if(!boota) printf("dlsym: %s\n",dlerror());
        boota();
        dlclose(h); 
        return 0;
}

4°) Compile it

gcc sadmain.c -ldl
./a.out
hello, i start booting
end boot

The other example should equally work.

	Juanjo

-- 
Max-Planck-Institut fuer Quantenoptik	+49/089/32905-127
Hans-Kopfermann-Str. 1, D-85748		www.arrakis.es/~worm
Garching b. Muenchen, Germany		worm at arrakis.es






More information about the ecl-devel mailing list