It seems that a client application needs to call InitializeNativeTarget or LLVMInitializeNativeTarget before doing any JITting. Unfortunately, LLVMInitializeNativeTarget is defined static inline and does not appear in the .a files; thus a client not written in C or C++ trying to JIT cannot link to the library and call LLVMInitializeNativeTarget that way. It can call a target-specific library function such as LLVMInitializeX86Target, but this is obviously not portable.
Kenneth Uildriks wrote:> It seems that a client application needs to call > InitializeNativeTarget or LLVMInitializeNativeTarget before doing any > JITting. Unfortunately, LLVMInitializeNativeTarget is defined static > inline and does not appear in the .a files; thus a client not written > in C or C++ trying to JIT cannot link to the library and call > LLVMInitializeNativeTarget that way.Yes, so you'll need to add a little C++ module to your wrapper that does the necessary initializations and is callable from your target language. Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr.Graef at t-online.de, ag at muwiinfa.geschichte.uni-mainz.de WWW: http://www.musikinformatik.uni-mainz.de/ag
On Wed, Oct 7, 2009 at 11:36 AM, Albert Graef <Dr.Graef at t-online.de> wrote:> Kenneth Uildriks wrote: > > Yes, so you'll need to add a little C++ module to your wrapper that does > the necessary initializations and is callable from your target language.That's odd, we don't need to do that for ocaml. Have you tried having a function like this defined in your binding? /* Force the LLVM interpreter and JIT to be linked in. */ void llvm_initialize(void) { LLVMLinkInInterpreter(); LLVMLinkInJIT(); } You don't have to call it, it's just there to make sure the execution engine is actually linked with the binding library.