0

A DLL provides functions that take reference to user defined data types as inputs/arguments and returns user defined data types as outputs. The user defined data types are created using C structures.

While calling the function from python (ctypes.cdll), how should these data types be created in python and how should the return value - which is also a user defined data type - be retrieved and processed?

Can an example of this use-case be provided?

  • There are plenty of such examples on [SO](https://stackoverflow.com), and probably even more on *Google*. Recents of my own (hope you'll find your answers): https://stackoverflow.com/questions/50447199/ctypes-struct-containing-arrays/50448338#50448338, https://stackoverflow.com/questions/50003760/python-ctypes-calling-a-function-with-custom-types-in-c/50020321#50020321, https://stackoverflow.com/questions/51507196/python-ctypes-to-return-an-array-of-function-pointers/51529527#51529527, https://stackoverflow.com/questions/50043861/python-ctypes-passing-pointer-for-data/50048663#50048663. – CristiFati Aug 22 '18 at 19:31
  • https://stackoverflow.com/questions/49962265/c-to-python-via-ctypes-wrapping-struct-of-function-pointers-to-static-function/49964860#49964860, https://stackoverflow.com/questions/49257742/how-to-model-struct-that-contains-reference-to-its-definition-in-python-through/49258268#49258268, https://stackoverflow.com/questions/29972991/python-ctypes-unable-to-pass-memory-array-in-a-structure/29974281#29974281, https://stackoverflow.com/questions/43000568/ctypes-mapping-a-returned-pointer-to-a-structure/43003221#43003221, ... – CristiFati Aug 22 '18 at 19:38
  • Thanks for the references! – user98185 Aug 23 '18 at 08:23
  • Sure. I only pointed my answers, there are many other great ones (and even better), that might contain exactly what you need. Yo just need to search for them :). – CristiFati Aug 23 '18 at 08:51

0 Answers0