Note that there are some explanatory texts on larger screens.

plurals
  1. PO"WindowsError: exception: access violation..." - ctypes question
    primarykey
    data
    text
    <p>Here is the prototype for a C function that resides in a DLL:</p> <pre><code>extern "C" void__stdcall__declspec(dllexport) ReturnPulse(double*,double*,double*,double*,double*); </code></pre> <p>In another thread, I asked about how to properly create and send the necessary arguments to this function.</p> <p>Here is the thread: <a href="https://stackoverflow.com/questions/1381016/how-do-i-wrap-this-c-function-with-multiple-arguments-with-ctypes">How do I wrap this C function, with multiple arguments, with ctypes?</a></p> <p>So I have used the good information in the thread above, but now I am getting this error: WindowsError: exception: access violation writing 0x00001001</p> <p>I am unsure as to how to proceed. I'm on Windows XP - if I log into the administrator account, would that fix the problem? Or is this a problem with Python's memory objects being immutable?</p> <p>Thanks all!</p> <p><strong>Edited with relevant Python:</strong></p> <pre><code>FROGPCGPMonitorDLL = windll.LoadLibrary('C:\Program Files\MesaPhotonics\VideoFROG 7.0\PCGPMonitor.dll') #Function argument:double* pulse sizePULSE = 2 ##Manual is super unclear here pulse = c_double * sizePULSE ptrpulse = pulse() #Function argument:double* tdl sizeTRACE = FROGPCGPMonitorDLL.GetSize() if sizeTRACE == 0 : sizeTRACE = 1 #Manually set size to 1 for testing purposes print "Size of FROG trace is zero. Probably not right." tdl = c_double*sizeTRACE ptrtdl = tdl() #Function argument:double* tdP sizeTRACE = FROGPCGPMonitorDLL.GetSize() if sizeTRACE==0: sizeTRACE=1 print "Size of FROG trace is zero. Probably not right." tdP = c_double*sizeTRACE ptrtdP = tdP() #Function Argument:double* fdl sizeTRACE = FROGPCGPMonitorDLL.GetSize() if sizeTRACE==0: sizeTRACE=1 print "Size of FROG trace is zero. Probably not right." fdl = c_double*sizeTRACE ptrfdl = fdl() #Function Argument: double* fdP sizeTRACE = FROGPCGPMonitorDLL.GetSize() if sizeTRACE==0: sizeTRACE=1 print "Size of FROG trace is zero. Probably not right." fdP = c_double*sizeTRACE ptrfdP = fdP() FROGPCGPMonitorDLL.ReturnPulse(ptrpulse, ptrtdl, ptrtdP,ptrfdl,ptrfdP) </code></pre> <p>Edited to add some relevant code! I'm just writing a simple script to get each of the device's functions working first. The variable sizeTRACE can be reused, I know, but its just test code right now and the device isn't hooked up, so GetSize() is returning zero. Multiplying by zero would kill my buzz, so I'm forcing it to 1 for now. If this isn't clear, I apologize and will try to edit this post.</p> <p>Second edit: It was suggested to plug in the device and see if that helped. I just plugged in the FROG, but I'm still getting the same error. Very strange, and I'm rather clueless. In any event, thanks again all!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload