- Thus, there's **no need to memorized boilerplate in `A3.c`** since the functions defined in that file can be found in the header file. I have included the [A3.h](https://git.kska.io/sppu-te-comp-content/SystemsProgrammingAndOperatingSystem/src/branch/main/Codes/Group%20A/Assignment-A3/A3.h) file in this folder for reference. Note that it is automatically generated.
- Create a new `A3.c` file which is the C program file containing function definitions (for add, sub, mul, div)
- Define all the functions (add, sub, mul, div)
- Then, we have to compile the C program file, i.e. `A3.c`. For this, run `gcc -shared -o libA3.so -fPIC -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/linux" A3.c`,
-`gcc` -> GNU compiler for C program
-`-shared` -> tells the compiler to create a shared file (.so) instead of a regular executable file
-`-o libA3.so` -> tells the compiler to save the output to `libA3.so` file
-`fPIC` -> stands for Position-Independent Code. Needed for creating shared libraries.
-`-I"$JAVA_HOME/include"` and `-I"$JAVA_HOME/include/linux"` -> `-I` flag used for specifiying directories to include. Values in double quotes are directories
-`A3.c` -> name of the C program file to compile
- Lastly, run the program using `java -Djava.library.path=. A3`
-`java` -> Loads Java Virtual Machine (JVM)
-`-Djava.library.path=.` -> `-D` is used to set a system property. In this case, we’re setting the `java.library.path` (for .so or .dll files) property.
-`A3` -> name of the Java class containing the main method