当前位置: 动力学知识库 > 问答 > 编程问答 >

c++ - Using Python to access DLL functions with Pointers

问题描述:

I'm trying to build a Python app to access data inside a proprietary file format (*.abf, by Axon Instruments). The fine folks who specify the format have released a DLL that contains functions you can use to open these files, read/write, etc.

So far so good. I've read a number of posts on SO and around the web about using ctypes to import DLLs, and this seems to work fine - but many of the useful functions in the DLL I'm trying to interact with take integer pointers as an argument, and ctypes doesn't have a data type for interacting with that.

Am I out of luck? Do I need to write this app in a different language, or is there some way to hack this together in Python?

Thanks all,

-Steve

网友答案:

Look deeper. Ctypes does have Pointers.

from ctypes import *
f = c_float()
f_pointer = pointer(f) # full pointer functionality
f_byref = byref(f) # minimalistic pointer just for passing by reference
分享给朋友:
您可能感兴趣的文章:
随机阅读: