-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathSample1.java
More file actions
29 lines (25 loc) · 1.02 KB
/
Sample1.java
File metadata and controls
29 lines (25 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public class Sample1
{
public native int intMethod(int n);
public native boolean booleanMethod(boolean bool);
public native String stringMethod(String text);
public native int intArrayMethod(int[] intArray);
public native int coreClrHost(String dllpath);
public static void main(String[] args)
{
//System.loadLibrary("Sample1");
System.load(System.getProperty("user.dir") + java.io.File.separator + "libtar.so");
Sample1 sample = new Sample1();
int square = sample.intMethod(5);
boolean bool = sample.booleanMethod(true);
String text = sample.stringMethod("JAVA");
int sum = sample.intArrayMethod(new int[]{1,1,2,3,5,8,13});
int success=0;
success= sample.coreClrHost("./bin/Debug/netcoreapp2.2/Managed.dll");
System.out.println("intMethod: "+ square);
System.out.println("boolMethod: "+ bool);
System.out.println("stringMethod: "+ text);
System.out.println("intArrayMethod: "+ sum);
System.out.println("status:"+success);
}
}