Hi! i'm new to plugin creation so i tried creating something very simple. I'll write here the pseudo-code of the scripts.
----------
**c language**
(.c) has a function sum(int,int) that returns the sum of 2 integers
(.h) header of the sum function
----------
**Objective-c [xcode]**
-includes my cfile.h
(.m) has a function max(int,int) that calls sum() from the cfile.
----------
After build in xcode i got the .a file and placed it in my Plugins/iOS. and called it in my c# script using the name of my .a is libiosplugin.a
i have a GuiText so i can see the result
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class myScript : MonoBehaviour {
private int holdme;
#if UNITY_IPHONE && UNITY_EDITOR
private const string PLATFORM_DLL = "__Internal";
#else
private const string PLATFORM_DLL = "iosplugin"; //please don't mind this part
#endif
[DllImport(PLATFORM_DLL)]
private static extern int max(int a, int b);
// Use this for initialization
void Start () {
holdme = max (12, 45);
gameObject.guiText.text = holdme.ToString ();
}
// Update is called once per frame
void Update () {
}
}
but when i run this it has an error EntryPointNotFoundException: max
myScript.Start () (at Assets/Scripts/myScript.cs:19)
please tell me where i went wrong :(
↧