"""This module contain functions used to load the chipmunk library""" __version__ = "$Id: libload.py 0 2013-03-01 18:24:38Z frbrgeorge@gmail.com $" # Actually this is QnD replacement to upstream's queer code import ctypes, ctypes.util def platform_specific_functions(): return {'library_loader' : ctypes.cdll, 'function_pointer' : ctypes.CFUNCTYPE} def load_library(libname, debug_lib=True): libfn = ctypes.util.find_library(libname) if debug_lib: print ("Loading [{0}]".format(libfn)) lib = platform_specific_functions()['library_loader'].LoadLibrary(libfn) return lib