我有在它的API中的一個使用一個函數 hello_printf(常量字符*格式,...)一個簡單的庫。而在下使用 這個庫,我使用的庫指向hello_printf的函數指針 的printf在外部應用程序和代碼無縫工作。提供的ctypes的函數外部定義的C/C++庫
hello_printf不是API,但在一個 API的的實施使用。原因是我希望使用庫的外部應用程序 提供printf(外部綁定)的實現。
現在我想在Python中使用這個庫,我使用的ctypes調用API的,但我無法找到一個方法來找到提供的功能外結合與ctypes的。 即將hello_printf()指向libc的printf,使得「hello_printf = libc.printf」。
這幾乎覆蓋http://stackoverflow.com/questions/16513708/how-to-export-ac-array-to -python/16525801#16525801和http://stackoverflow.com/questions/544173/mapping-a-global-variable-from-a-shared-library-with-ctypes,爲了完整性提及。 –