Added llvm.core.load_library_permanently() (Issue #12).
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@46 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
ecdc9ebd95
commit
b0a11dbbbc
6 changed files with 77 additions and 0 deletions
|
|
@ -21,6 +21,7 @@
|
|||
#include "llvm/IntrinsicInst.h"
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "llvm/Assembly/Parser.h"
|
||||
#include "llvm/System/DynamicLibrary.h"
|
||||
// +includes for passes
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Analysis/LoopPass.h"
|
||||
|
|
@ -198,6 +199,20 @@ unsigned char *LLVMGetBitcodeFromModule(LLVMModuleRef M, unsigned *Len)
|
|||
return bytes;
|
||||
}
|
||||
|
||||
/* Return 0 on failure (with ErrMsg filled in), 1 on success. */
|
||||
unsigned LLVMLoadLibraryPermanently(const char* filename, char **ErrMsg)
|
||||
{
|
||||
std::string msg;
|
||||
|
||||
/* Note: the LLVM API returns true on failure. Don't ask why. */
|
||||
if (sys::DynamicLibrary::LoadLibraryPermanently(filename, &msg)) {
|
||||
*ErrMsg = strdup(msg.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* passes */
|
||||
|
||||
#define define_pass(P) \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue