Creer une lib .so contenant +sieurs fichiers
yanis_00
-
kmf31 Messages postés 1564 Statut Contributeur -
kmf31 Messages postés 1564 Statut Contributeur -
Salut tout le monde,
Ma question c comment creer une librairie partagé sous linux sachant que une tel librairie a une extension .so
je veux rendre cette librarie dynamique.
Je sais crée une telle lib pour un seul fichier .c
gcc -fPIC -c toto.c
gcc -shared -Wl,-soname,libtoto.so.1 -o libtoto.so.1.0 toto.o
cp -f libtoto.so.1.0 /usr/local/lib
ln -sf libtoto.so.1.0 /usr/local/lib/libtoto.so.1
ln -sf /usr/local/lib/libtoto.so.1 /usr/local/lib/libtoto.so
ici il y a une creation d une librairie pour un seul fichier toto.c comment faire si on a plusieurs fichiers .c
Merci à tout le monde.
Salut
Ma question c comment creer une librairie partagé sous linux sachant que une tel librairie a une extension .so
je veux rendre cette librarie dynamique.
Je sais crée une telle lib pour un seul fichier .c
gcc -fPIC -c toto.c
gcc -shared -Wl,-soname,libtoto.so.1 -o libtoto.so.1.0 toto.o
cp -f libtoto.so.1.0 /usr/local/lib
ln -sf libtoto.so.1.0 /usr/local/lib/libtoto.so.1
ln -sf /usr/local/lib/libtoto.so.1 /usr/local/lib/libtoto.so
ici il y a une creation d une librairie pour un seul fichier toto.c comment faire si on a plusieurs fichiers .c
Merci à tout le monde.
Salut
A voir également:
- Cbk nous lib
- Nous n'avons pas pu terminer l'action pour le tableau croisé dynamique libérez de l'espace ✓ - Forum Excel
- Dr lib - Guide
- Cache lib - Forum Vos droits sur internet
- Error 2002 (hy000): can't connect to local mysql server through socket '/var/lib/mysql/mysql.sock' (2) ✓ - Forum Linux / Unix
- Quelle est la lib de strcpy ✓ - Forum Programmation
1 réponse
Il semble que tu es deja tres proche, en fait apparamment il faut faire:
gcc -fPIC -c toto1.c
gcc -fPIC -c toto2.c
gcc -shared -Wl,-soname,libtoto.so.1 -o libtoto.so.1.0 toto1.o toto2.o
Regarde ici ce HOWTO:
http://www.tldp.org/HOWTO/Program-Library-HOWTO/index.html
et notamment:
http://www.tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN95
(il semble que ce HOWTO n'a pas ete traduit en francais, au moins il n'est pas ici:
http://www.ibiblio.org/pub/Linux/docs/HOWTO/translations/fr/html/ )
gcc -fPIC -c toto1.c
gcc -fPIC -c toto2.c
gcc -shared -Wl,-soname,libtoto.so.1 -o libtoto.so.1.0 toto1.o toto2.o
Regarde ici ce HOWTO:
http://www.tldp.org/HOWTO/Program-Library-HOWTO/index.html
et notamment:
http://www.tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN95
(il semble que ce HOWTO n'a pas ete traduit en francais, au moins il n'est pas ici:
http://www.ibiblio.org/pub/Linux/docs/HOWTO/translations/fr/html/ )