Получение dllnotfoundexception при попытке создать собственное плагин C ++ для Unity. < /p>
firstdll.cpp
#include "FirstDll.h"
DLLExport int add(int a, int b){
return a+b;
}
FirstDll::FirstDll(){
}
FirstDll::~FirstDll(){
}
< /code>
firstdll.h
#define DLLExport __declspec(dllexport)
extern "C"{
DLLExport int add(int a, int b);
}
class FirstDll{
public:
FirstDll();
~FirstDll();
};
< /code>
Я тогда генерирую файл SO через эту команду < /p>
g++ -dynamiclib -flat_namespace -fms-extensions FirstDll.cpp -o libmyclass.so
< /code>
Я затем добавил этот файл .so в папке Assets /Plugins /x86_64, и в моем коде Unity C# я пытаюсь запустить этот кусок кода. < /p>
[DllImport("myclass")]
static extern int add(int a, int b);
< /code>
После получения этой ошибки я попытался перенести файл SO в разные местоположения и тестирование. Я всегда получаю dllnotfoundexception. < /P>
Found that the DllNotFoundException was coming bcoz the .so file
is not build using ndk-build.cmd.
Plz help me with the steps to build the .so file for android.
Подробнее здесь: https://stackoverflow.com/questions/603 ... -build-cmd