summaryrefslogtreecommitdiff
path: root/bindings/python/llvm/common.py
diff options
context:
space:
mode:
authorGregory Szorc <gregory.szorc@gmail.com>2012-03-09 18:56:33 +0000
committerGregory Szorc <gregory.szorc@gmail.com>2012-03-09 18:56:33 +0000
commit07c32218f448b7637d4acad8e87ce7cfaef0277e (patch)
tree09b98f3a686f3007b5a47266efe414b6d86712b0 /bindings/python/llvm/common.py
parent5992f67e683b665392f45b167fe5c9abd91455c9 (diff)
downloadllvm-07c32218f448b7637d4acad8e87ce7cfaef0277e.tar.gz
llvm-07c32218f448b7637d4acad8e87ce7cfaef0277e.tar.bz2
llvm-07c32218f448b7637d4acad8e87ce7cfaef0277e.tar.xz
[llvm.py] Make ObjectFile destructor work
Previous code had a double free in MemoryBuffer. The tests now pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152422 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/python/llvm/common.py')
-rw-r--r--bindings/python/llvm/common.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/bindings/python/llvm/common.py b/bindings/python/llvm/common.py
index 7818ff41a4..fe35bf124f 100644
--- a/bindings/python/llvm/common.py
+++ b/bindings/python/llvm/common.py
@@ -7,20 +7,24 @@
#
#===------------------------------------------------------------------------===#
+from ctypes import POINTER
+from ctypes import c_void_p
from ctypes import cdll
import ctypes.util
-import platform
__all__ = [
- "find_library",
- "get_library",
+ 'LLVMObject',
+ 'find_library',
+ 'get_library',
]
+LLVMObject = POINTER(c_void_p)
+
def find_library():
# FIXME should probably have build system define absolute path of shared
# library at install time.
- for lib in ["LLVM-3.1svn", "LLVM"]:
+ for lib in ['LLVM-3.1svn', 'LLVM']:
result = ctypes.util.find_library(lib)
if result:
return result
@@ -32,6 +36,6 @@ def get_library():
"""Obtain a reference to the llvm library."""
lib = find_library()
if not lib:
- raise Exception("LLVM shared library not found!")
+ raise Exception('LLVM shared library not found!')
return cdll.LoadLibrary(lib)