Last active
May 5, 2021 14:25
-
-
Save gandroz/7e2ad2ffbdf9483527dfee0ec6cdef0b to your computer and use it in GitHub Desktop.
Load C module helper function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_module(): | |
# load library | |
cmodule = ctypes.cdll.LoadLibrary('./levenshtein.so') | |
# define arguments type | |
cmodule.levenshtein.argtypes = [ctypes.c_char_p, | |
ctypes.c_char_p, | |
ctypes.c_int, | |
ctypes.c_int, | |
ctypes.c_int] | |
# define return type | |
cmodule.levenshtein.restype = ctypes.c_int | |
return cmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment