Is possible to load a function from *any|some* llvm generated code in iOS (not made by clang)?

133 Views Asked by At

If I build a function with LLVM, like

int sum(int a, int b)
{
    return a + b;
}

using something like http://www.llvmpy.org/llvmpy-doc/dev/doc/firstexample.html, is possible to use that function from inside iOS? as if was a function made with C/C++/Obj-c?

This is because I wonder if building a languaje on LLVM auto-magically provide the path to support iOS for free (ie: is as hard as embed python or something like that).

If yes, how can be done? (ie: call sum from obj-c)

1

There are 1 best solutions below

2
On BEST ANSWER

Yes, it is possible. I have done exactly that on Android. And iOS is similar enough that it should be possible there. As long as you are using Interpreter for executing your LLVM code. Because using JIT is forbidden by Apple Developer agreement.