Quantcast
Channel: Questions in topic: "dllimport"
Viewing all articles
Browse latest Browse all 160

c source code in unity project, EntryPointNotFoundException

$
0
0
So I am trying to create a simple (the simplest!) unity project that will run on an iPad using some c code. The code: //testPlugin.mm extern "C" { int afunction_c(){ int i=321; return i; } } And: //testScript.cs using UnityEngine; using System.Collections; using System.Runtime.InteropServices; public class test : MonoBehaviour { [DllImport ("__Internal")] private static extern int afunction_c(); static int afunction_csh(){ int i=afunction_c(); return i; } void Update () { Debug.Log(afunction_csh()); } } Assigning the script on a game object and trying to run inside Unity I get: > EntryPointNotFoundException: afunction_c testScript.afunction_csh () (at Assets/Plugin/iOS/testScript.cs:13) testScript.Update () (at Assets/Plugin/iOS/testScript.cs:21) Both files testPlugin.mm and testScript.cs are in Assets/Plugin/iOS/. Anyone has any idea what I am doing wrong here?

Viewing all articles
Browse latest Browse all 160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>