在Windows中,導入ctypes模塊時,ctypes.cdll.msvcrt
對象會自動存在,它代表msvcrt
Microsoft C++運行時庫according to the docs。ctypes中的msvcrt的不同版本
但是,我注意到,還有一個find_msvcrt函數,它將"return the filename of the VC runtype library used by Python"
。
它進一步指出,"If you need to free memory, for example, allocated by an extension module with a call to the free(void *), it is important that you use the function in the same library that allocated the memory."
所以我的問題是,什麼是ctypes.cdll.msvcrt
庫,我已經和我可以用find_msvcrt
功能加載之間的差異?在特定情況下,他們可能不是同一個圖書館?
相關:[在Windows上訪問msvcrt的方式有什麼區別?](https://stackoverflow.com/q/30790494/4279) – jfs 2017-10-17 10:37:51