La création d'une DLL requiert quelques modifications dans le fichier
Makefile vu à la sous-section 23.4.2:
OBJS = simple_math_sqrt.o
simple_math_pow.o
LIBNAME = simple_math SONAME = libsimple_math.so.1.0.0 SOVERSION = libsimple_math.so.1.0 CFLAGS = -Wall all: libs$(LIBNAME).so mon_test mon_test: libs$(LIBNAME).so mon_test.o gcc $(CFLAGS) -o $@ mon_test.o -L. -l${LIBNAME} lib$(LIBNAME).so: $(OBJS) gcc -shared $(CFLAGS) $(OBJS) -lc -Wl,-soname -Wl,$(SOVERSION) \ -o $(SONAME) && \ ln -sf $(SONAME) $(SOVERSION) && \ ln -sf $(SONAME) lib$(LIBNAME).so .c.o: gcc -fPIC -DPIC $(CFLAGS) -c -o $*.o *< clean: rm -f *.o *.a *.so mon_test |
Après l'exécution de make, nous obtenons:
lrwxrwxrwx | 1 root | root |
23 Sep 17 22:02
|
libsimple_math.so -> libsimple_math.so.1.0.0 |
lrwxrwxrwx | 1 root | root |
23 Sep 17 22:02
|
libsimple_math.so.1.0 -> libsimple_math.so.1.0.0 |
-rwxr-wr-w | 1 root | root |
6046 sep 17 22:02
|
libsimple_math.so1.0.0 |
-rwxr-xr-x | 1 root | root |
13677 Sep 17 22:02
|
mon_test |