- Home /
How to make external C# dll library loadable (reflection) on iPhone?
Hello,
My dll is generated from a simple class:
using UnityEngine;
public class TestDll : MonoBehaviour {
public void Awake() {
Debug.Log("-> TestDll.Awake()");
}
public void Start() {
Debug.Log("-> TestDll.Start()");
}
public void Test() {
Debug.Log("-> TestDll.Text()");
}
}
I put the dll under application's Document folder on iPhone, and use folloing code to load it:
Assembly assem = Assembly.Load(File.ReadAllBytes(Application.persistentDataPath + "/TestDll.dll"));
But I got error:
Non platform assembly: data-0x31c7e00 (this message is harmless) Failed to load AOT module 'data-0x31c7e00.dylib' in aot-only mode.
Then I did "mono --aot=full Test.dll" in Cygwin, and replaced it on iPhone, I got another error:
Non platform assembly: data-0xb16b000 (this message is harmless) Unhandled Exception: System.BadImageFormatException:
I googled, but didn't find answers.
Has anyone tried the same thing before? How did you make it?
Thank you
Comment
Answer by MonkeyWanson · Aug 06, 2016 at 02:10 PM
NoWay. IOS limit dynamic code. Can't add code runtime.
Your answer
![](https://koobas.hobune.stream/wayback/20220613065724im_/https://answers.unity.com/themes/thub/images/avi.jpg)