samedi 28 mars 2015

link a library I wrote with pthread library



This is actually part of an assignment. Basically, we need to write a library, which will be linked against test programs the professor writes, like so:



gcc -o libexample.o -c libexample.c
ar rvs libexample.a libexample.o

#later
gcc -o test test.c -L . -lexample


The thing is that libexample uses POSIX semaphores, which needs linking with the pthread library when generating the final executable. Without changing the way test program compiles, is there a way to package the pthread library with libexample.a?


Thanks!




Aucun commentaire:

Enregistrer un commentaire