1

How can I access a const float array from a DLL? I am currently getting an int out of the DLL using:

DLL = ctypes.cdll.LoadLibrary('some.dll')
x = ctypes.c_int.in_dll(DLL, 'x')

Is there a similar syntax to get out a float array? Note I also know its size. There is no existing function to return that array and I would prefer to not have to create one.

1 Answer 1

2

Try using:

ctypes.ARRAY(ctypes.c_float, array_length).in_dll(DLL, 'x')

Or with a prettier syntax:

(ctypes.c_float * array_length).in_dll(DLL, 'x')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.