diff --git a/Codes/Group A/Assignment-A3/A3.h b/Codes/Group A/Assignment-A3/A3.h new file mode 100644 index 0000000..f2002a1 --- /dev/null +++ b/Codes/Group A/Assignment-A3/A3.h @@ -0,0 +1,45 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class A3 */ + +#ifndef _Included_A3 +#define _Included_A3 +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: A3 + * Method: add + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_A3_add + (JNIEnv *, jobject, jint, jint); + +/* + * Class: A3 + * Method: sub + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_A3_sub + (JNIEnv *, jobject, jint, jint); + +/* + * Class: A3 + * Method: mul + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_A3_mul + (JNIEnv *, jobject, jint, jint); + +/* + * Class: A3 + * Method: div + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_A3_div + (JNIEnv *, jobject, jint, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Codes/Group A/Assignment-A3/EXPLANATION.md b/Codes/Group A/Assignment-A3/EXPLANATION.md index 3bdf4ee..5dd85be 100644 --- a/Codes/Group A/Assignment-A3/EXPLANATION.md +++ b/Codes/Group A/Assignment-A3/EXPLANATION.md @@ -7,6 +7,7 @@ This file contains explanation for dynamic linking library program (Assignment-A Please note the files referred in this guide: - [A3.java](https://git.kska.io/sppu-te-comp-content/SystemsProgrammingAndOperatingSystem/src/branch/main/Codes/Group%20A/Assignment-A3/A3.java) - [A3.c](https://git.kska.io/sppu-te-comp-content/SystemsProgrammingAndOperatingSystem/src/branch/main/Codes/Group%20A/Assignment-A3/A3.c) +- [A3.h](https://git.kska.io/sppu-te-comp-content/SystemsProgrammingAndOperatingSystem/src/branch/main/Codes/Group%20A/Assignment-A3/A3.h) --- @@ -20,7 +21,7 @@ Please note the files referred in this guide: - There will be a new file called `A3.h` in your current working directory, - This is the header file. - It contains signatures for native functions we created in the Java file. - - Thus, there's **no need to memorized `A3.c` file** since the functions defined in that file can be found in the header file. + - 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`,