c - link a library I wrote with pthread library -


this part of assignment. basically, need write library, linked against test programs professor writes, so:

gcc -o libexample.o -c libexample.c ar rvs libexample.a libexample.o  #later gcc -o test test.c -l . -lexample 

the thing libexample uses posix semaphores, needs linking pthread library when generating final executable. without changing way test program compiles, there way package pthread library libexample.a?

thanks!

without changing way test program compiles, there way package pthread library libexample.a?

no.

are restricted supplying single libexample.a file?

if not (and if using gnu linker), possible solution provide libexample.a linker script, link against e.g. libexample_code.a containing object files and add -lpthread.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -