From 7066a2d1436cf6a3261fcfc114eba23f4337407d Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 17 Jul 2019 22:46:12 +0200 Subject: Possible fix for .so segfaults --- bcdd/BCalcWrapper.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bcdd/BCalcWrapper.py b/bcdd/BCalcWrapper.py index 9337809..d7ed7cd 100644 --- a/bcdd/BCalcWrapper.py +++ b/bcdd/BCalcWrapper.py @@ -2,7 +2,7 @@ Wrapper class for libbcalcDDS.dll ''' -from ctypes import cdll +from ctypes import cdll, c_void_p from .Exceptions import DllNotFoundException @@ -25,7 +25,12 @@ class BCalcWrapper(object): def __getattr__(self, attrname): def _dynamic_method(*args): - return getattr(self.libbcalcdds, 'bcalcDDS_' + attrname)(*args) + function = getattr(self.libbcalcdds, 'bcalcDDS_' + attrname) + if attrname == 'new': + function.restype = c_void_p + else: + function.argtypes = [c_void_p] + return function(*args) return _dynamic_method def declarerToLeader(self, player): -- cgit v1.2.3