Hello all!
I have a question about using native .so file in unity!
I’m trying to use enet UDP library in unity android.
I have c# functions which wrapped native c functions.
const string LIB = "enet.so";
[DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_peer_disconnect")]
static extern void native_peer_disconnect(ENetPeer* peer, uint data);
[DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_peer_disconnect_now")]
static extern void native_peer_disconnect_now(ENetPeer* peer, uint data);
I added .so files divided by flatform folders in unity plugin.
But if I build them to android and execute with BlueStacks, then those messages are logged.
In unity editor, it works fine because I have other functions for x86, x64 and those are included in unity editor.
I think it’s because of the .so file that built by android ndk gradle builder.
Actually I don’t know the right way to make .so file for just c#.
I saw many posts that makes jni functions for java.
But in this case, I’ll not use any java code.
I just want to call c functions in unity c# script like dll import.
Do I have to make all jni functions even if not using any java code??