Add DynamicLibrary and InlineFunction
This commit is contained in:
parent
c66dad7ece
commit
60336d1c5f
3 changed files with 64 additions and 3 deletions
|
|
@ -6,6 +6,7 @@
|
|||
#include <llvm/Support/raw_ostream.h>
|
||||
#include <llvm/Support/FormattedStream.h>
|
||||
#include <llvm/Support/MemoryBuffer.h>
|
||||
#include <llvm/Support/DynamicLibrary.h>
|
||||
#include <llvm/Bitcode/ReaderWriter.h>
|
||||
#include <llvm/ExecutionEngine/ExecutionEngine.h>
|
||||
#include <llvm/ExecutionEngine/GenericValue.h>
|
||||
|
|
@ -747,3 +748,28 @@ PyObject* IRBuilder_CreateAggregateRet(llvm::IRBuilder<>* builder,
|
|||
return pycapsule_new(inst, "llvm::Value", "llvm:ReturnInst");
|
||||
}
|
||||
|
||||
static
|
||||
PyObject* DynamicLibrary_LoadLibraryPermanently(const char * Filename,
|
||||
PyObject* ErrMsg = 0)
|
||||
{
|
||||
using namespace llvm::sys;
|
||||
bool failed;
|
||||
if (ErrMsg) {
|
||||
std::string errmsg;
|
||||
failed = DynamicLibrary::LoadLibraryPermanently(Filename, &errmsg);
|
||||
if (failed) {
|
||||
if (-1 == PyFile_WriteString(errmsg.c_str(), ErrMsg)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
failed = DynamicLibrary::LoadLibraryPermanently(Filename);
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
Py_RETURN_TRUE;
|
||||
} else {
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue