Skip to main content

Posts

Showing posts with the label library

C Traps & Pitfalls Book PDF Online by Andrew Koenig

C Traps & Pitfalls Book PDF Online by Andrew Koenig C Traps and Pitfalls is a slim computer programming book by former AT&T researcher and programmer Andrew Koenig, its first edition still in print in 2005, which outlines the many ways in which beginners and even sometimes quite experienced C programmers can write poor, malfunctioning and dangerous source code. It evolved from an earlier technical report published internally at Bell Labs, but is now available online in pdf form. <br> Happy coding.

Difference Between Static And Shared Libraries ?

Libraries are collection of precompiled functions which have been written to be reusable. Libraries in Linux are classified into two types: 1) Static Libraries :- The collection of object files kept together. When a program needs a function, that is stored in static library, it includes the header file that declares the function. The compiler combines the program code and linker links the library into an execuatble code. Static Libraries are also called as archives that ends with .a extension. e.g. /usr/lib/libc.a is a standard C library. Disadvantage of Static Libraries:- In the static libraries the function code is included in the executable. So when we run many applications that use the same function code, we end up with many copies of same functions in memory. 2) Shared Libraries :- When a program uses a function in a shared library, then that code does not get included in the execuatable. Instead it references to shared code that will be made available...

Learning ARM linux commands for creating library

ARM Linux commands starts with arm-linux-* for example compiling source code for ctime.c be $ arm-linux-gcc -c -o ctimer.o ctimer.c This linux command generates ctimer.o as output. I was searching for the ARM-Linux command which will give me library. $ arm-linux-ar cr libctimer.a ctimer.o This command gives libctimer.a library to use in ARM linux platform. Simple usage will be, say this timer library want to use in test.c Compile test.c as $ arm-linux-gcc -L. -o tester -I. test.c -lctimer here . indicates library path, where the library is stored. And your exe tester is ready.