I have a dll that was written in ada, and I'd like to use it in a Unity project, with C#. The problem is that I'm getting an EntryPointNotFoundException error.
For example, the ada code contains a function Initialize_Test, that returns a long. From what I can tell it is exporting this properly to interface with C languages and avoid name mangling:
pragma Export (C, Initialize_Test, "Initialize_Test");
and then in my c# I have:
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class menuControl : MonoBehaviour {
[DllImport ("test_dll", EntryPoint="Initialize_Test" )]
public static extern int Initialize_Test();
void Start () {
Debug.Log(Initialize_Test () );
}
}
It gets as far as Initialize_Test(), under the . according to http://www.mono-project.com/docs/advanced/pinvoke/#marshaling, that means that it's finding the dll alright (it was placed in the plugins folder) but cannot find the function "Initialize_Test".
http://docs.go-mono.com/?link=T%3aSystem.TypeLoadException has some suggestions as to what could be causing this, but none of them look like they apply here. I suppose the only thing left to do is to just get the mangled names with dumpbin.exe, but I feel like there should be a proper way to do this.
The person who compiled the dll assures me that other people have used it successfully, but none of them were using Unity, much less C#. I'm afraid that there's just something about Ada that makes it incompatible, I saw a bit in Unity's documentation that suggested it is simply unable to accept native code generated from certain compilers.