I finally figured it out, had to add some encoding, decoding and converting.
This is my running version:
from ctypes import cdll, c_char_p, create_string_buffer
def main():
test_lib = cdll.LoadLibrary('./libAmSoundex.so')
test_lib.AmericanSoundex.argtype = c_char_p
test_lib.AmericanSoundex.restype = c_char_p
mystring = "robert james fischer"
soundex_res = ''
for token in mystring.split():
buf_token = create_string_buffer(token.encode(), len(token))
soundex_res += str(test_lib.AmericanSoundex(buf_token).decode()) +
' '
print('The Soundex is:', soundex_res)
if __name__ == '__main__':
main()
Sorry for posting so much Python code. We have got a little handmade FFI for
strings, at least. :)