layout: true
Class 11: Libraries
--- class: center, middle # Libraries ### Class 11 --- # Overview 1. Announcements 2. Review 3. Q&A 4. Basic assignment --- # Announcements * Python assignments due Dec 6 * Debug assignments due Dec 13 * Libraries assignments due Dec 20 -- * Projects due at the end of Dec 21 -- * Category totals are posted * Will be updated as assignments get graded --- # 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` for a given library name e.g. `libname.so` or `libname.a` at the end of compilation command * (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