Added header file for reference.
This commit is contained in:
parent
c9864cb436
commit
a0adddeb8c
45
Codes/Group A/Assignment-A3/A3.h
Normal file
45
Codes/Group A/Assignment-A3/A3.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||||
|
#include <jni.h>
|
||||||
|
/* 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
|
@ -7,6 +7,7 @@ This file contains explanation for dynamic linking library program (Assignment-A
|
|||||||
Please note the files referred in this guide:
|
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.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.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,
|
- There will be a new file called `A3.h` in your current working directory,
|
||||||
- This is the header file.
|
- This is the header file.
|
||||||
- It contains signatures for native functions we created in the Java 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)
|
- 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)
|
- 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`,
|
- 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`,
|
||||||
|
Loading…
Reference in New Issue
Block a user