1

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)

mamcx
  • 15,916
  • 26
  • 101
  • 189

1 Answers1

0

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.

Mārtiņš Možeiko
  • 12,733
  • 2
  • 45
  • 45
  • Any example in how do this? – mamcx Dec 06 '12 at 17:07
  • Compile llvm/clang targeting iOS. And then use their API to parse C code, generate bitcode, and call LLVM interpreter on it. There exists bunch of documentation/samples about it on internet or look into LLVM sources. – Mārtiņš Možeiko Dec 06 '12 at 19:21