reach-vb's picture
reach-vb HF staff
662f462e0f601fcce9aec0bf0aceeab3e0c0e219783432fa02431d37567ec282
c65f48d
raw
history blame
No virus
657 Bytes
from llvmlite.binding import ffi
def create_context():
return ContextRef(ffi.lib.LLVMPY_ContextCreate())
def get_global_context():
return GlobalContextRef(ffi.lib.LLVMPY_GetGlobalContext())
class ContextRef(ffi.ObjectRef):
def __init__(self, context_ptr):
super(ContextRef, self).__init__(context_ptr)
def _dispose(self):
ffi.lib.LLVMPY_ContextDispose(self)
class GlobalContextRef(ContextRef):
def _dispose(self):
pass
ffi.lib.LLVMPY_GetGlobalContext.restype = ffi.LLVMContextRef
ffi.lib.LLVMPY_ContextCreate.restype = ffi.LLVMContextRef
ffi.lib.LLVMPY_ContextDispose.argtypes = [ffi.LLVMContextRef]