From f26ed63f397ef3fe80e9e0a7afc261e697ddbaf1 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Mon, 14 Jul 2008 10:43:48 +0100 Subject: [PATCH] Enable handling of the int32_t type --- pybindgen/typehandlers/inttype.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pybindgen/typehandlers/inttype.py b/pybindgen/typehandlers/inttype.py index 72a183b..63179b3 100644 --- a/pybindgen/typehandlers/inttype.py +++ b/pybindgen/typehandlers/inttype.py @@ -2,6 +2,10 @@ # documented in base.py) # pylint: disable-msg=C0111 +import struct +assert struct.calcsize('i') == 4 # assumption is made that sizeof(int) == 4 for all platforms pybindgen runs on + + from base import ReturnValue, Parameter, PointerParameter, PointerReturnValue, \ ReverseWrapperBase, ForwardWrapperBase, TypeConfigurationError, NotSupportedError @@ -9,7 +13,7 @@ from base import ReturnValue, Parameter, PointerParameter, PointerReturnValue, \ class IntParam(Parameter): DIRECTIONS = [Parameter.DIRECTION_IN] - CTYPES = ['int'] + CTYPES = ['int', 'int32_t'] def convert_c_to_python(self, wrapper): assert isinstance(wrapper, ReverseWrapperBase) @@ -110,7 +114,7 @@ class UnsignedIntPtrParam(PointerParameter): class IntReturn(ReturnValue): - CTYPES = ['int'] + CTYPES = ['int', 'int32_t'] def get_c_error_return(self): return "return INT_MIN;"