![](/img/trans.png)
[英]How do I get values from a C dll array pointer using ctypes and Python
[英]Get const array from DLL using ctypes
如何從DLL訪問const float數組? 我目前正在使用以下方法從DLL中獲取一個整數:
DLL = ctypes.cdll.LoadLibrary('some.dll')
x = ctypes.c_int.in_dll(DLL, 'x')
是否有類似的語法可以得出float數組? 注意我也知道它的大小。 沒有現有的函數可以返回該數組,我希望不必創建一個數組。
嘗試使用:
ctypes.ARRAY(ctypes.c_float, array_length).in_dll(DLL, 'x')
或使用更漂亮的語法:
(ctypes.c_float * array_length).in_dll(DLL, 'x')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.