layout: true
Class 11: Libraries
--- class: center, middle # Libraries ### Class 11 --- # Overview 1. Announcements 2. Review 3. Q&A 4. Basic assignment --- # Announcements * Debug assignments due April 5 * Libraries assignments due April 12 -- * Projects due at the end of April 18 * Last time to submit assignments will be April 27 11:59 PM EDT, full stop. * I will be running the scripts to calculate and bundle grades for WolverineAccess after -- * Will be posting category totals * Will be updated as assignments get graded * Plan on having a special `eecs201-test` command update it for you --- # Review * Static libraries go directly inside the executable * Libraries are an inherent part of the executable * Dynamic/shared libraries are referred to by the executable * Libraries are loaded at load/runtime --- # Review * Really easy to link a library * Toss `-lname` at the end of compilation command * `-lpng` for `libpng.so` or `libpng.a` * `-lm` for `libm.so` or `libm.a` * (Linux) `-l:libname.a` is an explicit way to specify library file to link * `-Ldir` can specify additional directories to look for libraries * You can also link against a library by providing the path to the library file as an argument (particularly useful for static libraries) -- * Creating a library * Create object code with `-c` * Dynamic object code requires `-fPIC` flag * Static: `ar rcs libname.a file.o` * Dynamic: `gcc -shared -o libname.so file.o` --- class: center, middle # Q&A --- class: center, middle # Basic assignment