From 5d35685b5eb25122d8c7d97463e0b9c2a3b40b83 Mon Sep 17 00:00:00 2001 From: Jan Kleinert Date: Fri, 15 Oct 2021 14:52:25 +0200 Subject: [PATCH] fix #842 --- bindings/bindings_generator/python_generator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bindings/bindings_generator/python_generator.py b/bindings/bindings_generator/python_generator.py index 0163535ab..79e753c73 100644 --- a/bindings/bindings_generator/python_generator.py +++ b/bindings/bindings_generator/python_generator.py @@ -51,7 +51,7 @@ def create_wrapper(self, cparser): if self.license: string += self.license - string += 'import sys, ctypes\n\n' + string += 'import sys, ctypes, ctypes.util\n\n' for enumname, values in cparser.enums.items(): string += self.create_enum(enumname, values) + '\n\n' @@ -120,7 +120,8 @@ def create_constructor(self): string += indent + 'try:\n' string += indent + ' if sys.platform == \'win32\':\n' - string += indent + ' lib = ctypes.cdll.%s\n' % self.libname + string += indent + ' name = ctypes.util.find_library("%s")\n' % self.libname + string += indent + ' lib = ctypes.cdll.LoadLibrary(name)\n' string += indent + ' elif sys.platform == \'darwin\':\n' string += indent + ' lib = ctypes.CDLL("lib%s.dylib")\n' % self.libname string += indent + ' else:\n'