Fix object format on Windows (thanks Axel for the hint!)

Solves the following error on Windows (as reported on the forum: https://root.cern.ch/phpBB3/viewtopic.php?f=21&t=19033):
[cling]$ int i = 0;
>>> Caught an interpreter exception!
>>> Incompatible object format!
This commit is contained in:
Bertrand Bellenot 2015-05-28 15:11:15 +02:00 committed by sftnight
parent 7db73eb500
commit 15dda8ada2

View File

@ -67,6 +67,12 @@ std::unique_ptr<TargetMachine>
IncrementalExecutor::CreateHostTargetMachine() const {
// TODO: make this configurable.
Triple TheTriple(sys::getProcessTriple());
#ifdef _WIN32
/*
* MCJIT works on Windows, but currently only through ELF object format.
*/
TheTriple.setObjectFormat(llvm::Triple::ELF);
#endif
std::string Error;
const Target *TheTarget
= TargetRegistry::lookupTarget(TheTriple.getTriple(), Error);