windows - Python ctypes identifying dll function result -


There are some functions in accordance with the documentation of the DLL have (more):

  # In the second example, there are 2 lines, just define the # calllet __stdcall # define the PLSANL void * PLSNVL collatees LScrate ANVL (Intel) LSOPENLog FILEL (PLSNALL PL, 4 * PCLGFile) Intel CallTeSS LSCT Pointerl (PLSNVL PL, Double * PDPInter, IN T * Pianpiintrnoav) is Int LSexecuteScriptL (pLSenvL PL, four * PcScript) integer LScloseLogFileL (pLSenvL pl) zero LSclearPointers (pLSenvL pl)  

I have done so far this:

  ctypes import * API = CDLL ( "PATH_TO_DLL") pLEnv = api.LScreateEnvL () script to <= "full" Print api.LSexecuteScriptL (pLEnv, script STRING orders) / code>  

and it works, but now I want to copy an example of what I found:

  void Sisdielji :: Onsoliv () {Int Anaarar, Anpointr now; CSTING CSSPT, CS; Double Dਿਨides [1], Dishart [1]; Donis [0] = (Double) Annidies M; PLSNVL PL; PL = LSVT ANVL (); NError = LSopenLogFileL (PL, "log_file.log"); NError = LSsetPointerL (PL, Dunnies & amp; nPointersNow); NError = LSsetPointerL (PL, dStart, and nPointersNow); Cscript = "SET ECHOIN 1 \ n"; // script nError = LSexecuteScriptL (PL, (LPCTSTR) run cscript); // Close the log file LScloseLogFileL (PL); CsStartM.Format ("% d", (int) dStart [0]); }  

So far I have this:

  nError = c_int nPointersNow = c_int dNeeds = c_double () # I'm just set a random value dNeeds = [c_double (10)] pLEnv = api.LScreateEnvL () n error = api.LSopenLogFileL (pLEnv, "log_file.log") here # I called the # processing not enough arguments (8 bytes missing) or wrong conference calling n error found = Api.LSsetPointerL (pLEnv, byref (dNeeds), nPointersNow) # and here I # byref logic meet should be a ctypes instance, not 'list'  

That's why I Have searched and I like this There was something to do

  # here comes my problem. ####################################################### # # # # # # # # C_int api.LSsetPointerL.argtypes = [¿?, C_double, c_int]  
  • what should be the first element in the array of argitpes ??
  • Do I care about some collegiate definitions?

Thanks in advance

" enough arguments (8 bytes missing) or went procedure "calls with the wrong calling convention which means that you say how the DLL you used Seedielel, but it says" # Colstip __stdikl Define ", so you should use WinDLL instead (). It works sometimes but is failing on more complex calls.

You are not implying that nPointersNow , you probably mean nPointersNow () .

You can not set dNeeds to create a list. Perhaps you mean:

  somefunc.argtypes = [c_double ()] dNeeds = c_double (10) n error = api.LSsetPointerL (pLEnv, ByRef (dNeeds), nPointersNow)  

More type plSenvL should be defined somewhere in your docs. LScreateEnvL is shown in the form of the form, as shown here:

  pLSenvL CALLTYPE LScreateEnvL () pLSenvL __stdcall LScreateEnvL () (& lt; - Line really means this)  

So you have to know what it is. We need one can only speculate that it is LSenvL called a pointer to something (an integer), which you may create a structure is not difficult, but you should know how to do it Is defined. He said, you may be able to avoid it because the first function gives it. If you do not need to use it then you can try it straightforward and efficiently in this way:

  LScreateEnvL = api.LScreateEnvL LScreateEnvL.restype = c_int # Just assume this is an integer LSopenLogFileL = APIs LSopenLogFileL LSopenLogFileL.restype = c_int LSopenLogFileL.argtypes = (c_int, # Then just assume c_char_p) LSsetPointerL = api.LSsetPointerL LSsetPointerL.restype = c_int LSsetPointerL.argtypes = (c_int, # value count digits (c_double), POINTER (c_int)) PLSenvL = LScreateEnvL () dPointer = c_double () nPointersNow = c_int () nError = LSsetPointerL (PLSNLL, byref (dPointer), byref (nPointersNow))  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -