python - Call a function in a DLL and use an array as argument -


i calling function dll written in c. in documentation of dll says 1 of arguments of function should be:

an address of array of 32-bit floating point numbers populated results.

i not familiar c , tell me c feature. not quite sure should use argument.

i using ctypes.

here example documentation of dll:

           float fresult;            long lretval = d2r_getsingleresult(                              "e:\\folder",                              "e:\\folder\\proj1",                              2001001, &fresult, 1, null, null ); 

another approach declare function type ctypes deduce itself:

d2r = ctypes.cdll.loadlibrary("d2r.so") d2r_getsingleresult = d2r.d2r_getsingleresult d2r_getsingleresult.argtypes = (ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ctypes.pointer(ctypes.c_float), ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p) d2r_getsingleresult.restype = ctypes.c_int ... fresult = ctypes.c_float() lretval = d2r_getsingleresult("folder", "folder\\proj1", 2001001, fresult, 1, none, none) 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -