i have ar application. created c++ dll using visual studio 2013. use dll in ar application below :
**in private members region :** [dllimport ("dllexample")] private static extern int func(int x, int y); ....... **in c# function :** if (func((int)pos.x, (int)pos.y) == -1) { ... } else { ... }
my unity application works fine unity editor. build app android. when run on android device, doesn't work.
content of c++ dll :
// dllmain.cpp : defines entry point dll application. #include "stdafx.h" #include <opencv2\core\core.hpp> #include <opencv2\highgui\highgui.hpp> #include <opencv2\imgproc\imgproc.hpp> #include <fstream> #include <iostream> extern "c" __declspec(dllexport) int func(int x, int y); bool apientry dllmain( hmodule hmodule, dword ul_reason_for_call, lpvoid lpreserved ) { switch (ul_reason_for_call) { case dll_process_attach: case dll_thread_attach: case dll_thread_detach: case dll_process_detach: break; } return true; } __declspec(dllexport) int func(int x, int y) { cv::rng rng(12345); cv::mat image0, image, gray, mask; int ffillmode = 1; int lodiff = 20, updiff = 20; int connectivity = 4; int iscolor = true; bool usemask = false; int newmaskval = 255; return x; }
in unity c# file, if remove call dll function, application works fine on android device .i use free unity version. how can use c++ dll on mobile device?
you need place dll file in in android plugin folder work. android plugin folder assets/plugins/android. create if doesnt exit.
edit: unity plugin not available in non pros according research. unity plugin supported in both free , pro unity 5. need update unity 5. here link of person made unity support plugin in unity free version.
Comments
Post a Comment