llvm.org GIT mirror llvm / e46161f
Fix the Ocaml bindings for the ExecutionEngine: with the change to build libraries instead of relinked objects, the interpreter, JIT, and native target libraries were not being linked in to an ocaml program using the ExecutionEngine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74117 91177308-0d34-0410-b5e6-96231b3b80d8 Bob Wilson 11 years ago
6 changed file(s) with 16 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
1515 \*===----------------------------------------------------------------------===*/
1616
1717 #include "llvm-c/ExecutionEngine.h"
18 #include "llvm-c/Target.h"
1819 #include "caml/alloc.h"
1920 #include "caml/custom.h"
2021 #include "caml/fail.h"
2223 #include
2324 #include
2425
26 /* Force the LLVM interpreter, JIT, and native target to be linked in. */
27 void llvm_initialize(void) {
28 LLVMLinkInInterpreter();
29 LLVMLinkInJIT();
30 LLVMInitializeNativeTarget();
31 }
2532
2633 /* Can't use the recommended caml_named_value mechanism for backwards
2734 compatibility reasons. This is largely equivalent. */
1717 #include "llvm/ExecutionEngine/ExecutionEngine.h"
1818 #include
1919
20 namespace llvm {
21 extern void LinkInInterpreter();
22 }
20 extern "C" void LLVMLinkInInterpreter();
2321
2422 namespace {
2523 struct ForceInterpreterLinking {
3129 if (std::getenv("bar") != (char*) -1)
3230 return;
3331
34 llvm::LinkInInterpreter();
32 LLVMLinkInInterpreter();
3533 }
3634 } ForceInterpreterLinking;
3735 }
1717 #include "llvm/ExecutionEngine/ExecutionEngine.h"
1818 #include
1919
20 namespace llvm {
21 extern void LinkInJIT();
22 }
20 extern "C" void LLVMLinkInJIT();
2321
2422 namespace {
2523 struct ForceJITLinking {
3129 if (std::getenv("bar") != (char*) -1)
3230 return;
3331
34 llvm::LinkInJIT();
32 LLVMLinkInJIT();
3533 }
3634 } ForceJITLinking;
3735 }
2424 #ifdef __cplusplus
2525 extern "C" {
2626 #endif
27
28 void LLVMLinkInJIT(void);
29 void LLVMLinkInInterpreter(void);
2730
2831 typedef struct LLVMOpaqueGenericValue *LLVMGenericValueRef;
2932 typedef struct LLVMOpaqueExecutionEngine *LLVMExecutionEngineRef;
2828
2929 }
3030
31 namespace llvm {
32 void LinkInInterpreter() {
33 }
34 }
31 extern "C" void LLVMLinkInInterpreter() { }
3532
3633 /// create - Create a new interpreter object. This can never fail.
3734 ///
5959
6060 }
6161
62 namespace llvm {
63 void LinkInJIT() {
64 }
62 extern "C" void LLVMLinkInJIT() {
6563 }
6664
6765