Add calling_conv.
Set win32 api to use CC_X86_STDCALL. (need testing)
This commit is contained in:
parent
d390960657
commit
a046685b2c
1 changed files with 6 additions and 0 deletions
|
|
@ -1334,6 +1334,9 @@ class CExternal(object):
|
|||
All class attributes that are `llvm.core.FunctionType` are converted
|
||||
to `CFunc` instance during instantiation.
|
||||
'''
|
||||
|
||||
_calling_convention_ = None # default
|
||||
|
||||
def __init__(self, cbuilder):
|
||||
is_func = lambda x: isinstance(x, lc.FunctionType)
|
||||
non_magic = lambda s: not ( s.startswith('__') and s.endswith('__') )
|
||||
|
|
@ -1347,6 +1350,9 @@ class CExternal(object):
|
|||
mod = cbuilder.function.module
|
||||
for fname, ftype in to_declare:
|
||||
func = mod.get_or_insert_function(ftype, name=fname)
|
||||
if self._calling_convention_:
|
||||
func.calling_convention = self._calling_convention_
|
||||
|
||||
if func.type.pointee != ftype:
|
||||
raise NameError("Function has already been declared "
|
||||
"with a different type: %s != %s"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue