0% found this document useful (0 votes)
2 views4 pages

Exp 2 OS

The document outlines an experiment to create a static and dynamic link library for complex number operations and test it using the linuxld linker. It describes the differences between static and dynamic linking, detailing the steps to create a static library and a dynamic library with sample code and execution instructions. Additionally, it poses a post-lab question to create a scientific calculator program in C utilizing both linking methods for various mathematical operations.

Uploaded by

Harshav Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Exp 2 OS

The document outlines an experiment to create a static and dynamic link library for complex number operations and test it using the linuxld linker. It describes the differences between static and dynamic linking, detailing the steps to create a static library and a dynamic library with sample code and execution instructions. Additionally, it poses a post-lab question to create a scientific calculator program in C utilizing both linking methods for various mathematical operations.

Uploaded by

Harshav Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment 2

Aim: Write a program for creating a static/dynamic link library for complex number operations
and then test this library through linuxld linker.

Static Linking: The linker copies all library routines used in the program into executable image.
As a result, it requires more memory space. As it does not require the presence of library on the
system when it is running, so it is faster and more portable and there is less chance of error.

Dynamic linking: Dynamic linking is performed during the run time. This linking is
accomplished by placing the name of a shareable library in the executable image. It requires
less memory space as multiple programs can share a single copy of the library.

Procedure (Along with sample code & output):


1. Static Library:
a. Create a C file for performing any complex operation ( for example: finding the
area of a cylinder, factorial of a number, prime factors of a number, etc)

b. Create a header file (lib_mylib.h) for the library.


c. Create a driver program that uses the created library.

d. Creating the static library. Compiling the driver program and including the static
library in it.
e. Executing the driver program.

2. Dynamic Linking:
a. After creating the same C, header, and driver files as above, compile the C files.
Creating a dynamic library and compiling the driver program using the dynamic
library.
b. Executing the driver program.

Post lab question:


Create a scientific calculator program in C using static and dynamic linking. Create a separate
file for each operation:
1. Basic arithmetic operations (addition, subtraction, multiplication, and division)
2. Trigonometric operations (sine, cosine, and tangent)
3. Logarithmic operations (natural logarithm and log base 10)
4. Exponential operations (e^x and x^y)
5. Factorial operation (n!)

You might also like