import ctypes malib = ctypes.CDLL("./target/release/libpy.so") class Bidule(ctypes.Structure): _fields_ = [ ("i", ctypes.c_int) ] fct_afficher = malib.afficher fct_afficher.argtypes = [ ctypes.c_char_p, ctypes.POINTER( Bidule ) ] fct_afficher.restype = ctypes.c_int; b = Bidule( i = 42 ) r = fct_afficher( "bonjour - éèà".encode( "utf-8" ), b ) print("le retour est :", r) print("Bidule.i =", b.i)