Implicit Dynamic Linking:
Let us consider once again math.c file for dynamic linking. We want to make it as a dynamic library. First we compile it with position independent flag on(-fPIC). This is needed for dynamic/static linking.
$cc -fPIC -c math.c
Now make a shared library with the object file.
$cc -shared libmath.so math.o
To use this shared library in a application we need to do the following steps:
- compile the application code (place math.h in include folder)
$cc -c app.c -Iinclude -o app.o
- Link with import library math.lib
$ld app.o -lmath -o app
- Copy the libmath.so in lib path or current path and run the application
About our authors: Team EQA
You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Draw on printer Free alt softwares