forked from DragonLi-Mi/CSharpCallJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.cs
More file actions
23 lines (21 loc) · 640 Bytes
/
init.cs
File metadata and controls
23 lines (21 loc) · 640 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;
using System.Runtime.InteropServices;
namespace invoke
{
class Program
{
[DllImport("libc.so.6")]
private static extern int getpid();
// You should edit the path of you .so lib
[DllImport("./wraper.so",EntryPoint="Invokejava")]
private static extern int Invokejava(string message);
static void Main(string[] args)
{
int pid= getpid();
Console.WriteLine(pid);
Console.WriteLine("Hello World!");
int status= Invokejava("Hi C# to cpp");
Console.WriteLine(status);
}
}
}