title: LabVIEW + C-DLL: Access violation (0xC0000005) at EIP = 0x00000000
body: <p><strong>Information:</strong>
  LabVIEW: 2019
  Version: 19.0.1 (32-bit)
  <strong>Operating system:</strong> Windows 64-bit</p>
  <p>Labview crashes completely after an indefinite time. I call three functions of the C-DLL. I loop through all the functions of the DLL over and over again. After about 2 minutes to an hour Labview crashes without reason.
  <a href="https://i.stack.imgur.com/7ecSy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7ecSy.png" alt="VI" /></a></p>
  <p>Calling of <code>OpenConnection()</code>:
  <a href="https://i.stack.imgur.com/S7aof.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S7aof.png" alt="OpenConnection" /></a></p>
  <p>Calling of <code>QueryOpenConnectionStatus()</code>:
  <a href="https://i.stack.imgur.com/FFWm5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FFWm5.png" alt="QueryOpenConnectionStatus" /></a></p>
  <p>Calling of <code>CloseConnection()</code>:
  <a href="https://i.stack.imgur.com/jSPc2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jSPc2.png" alt="CloseConnection" /></a></p>
  <p>Type definition of <code>TConnectionResult</code></p>
  <p><a href="https://i.stack.imgur.com/SLylL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SLylL.png" alt="TConnectionResult" /></a></p>
  <p>Follow the given <code>Headerfile.h</code></p>
  <pre><code>#ifndef __epMCOMLib_h_
  #define __epMCOMLib_h_
  #include &lt;stdint.h&gt;
  #include &lt;stddef.h&gt;
  #define DLLIMPORT __declspec(dllimport) 
  #pragma pack (push,1)
  
  
  typedef struct {
    uint16_t DLLFailureCode;
    uint8_t ConnectionStatus;
    uint32_t SystemFailureCode;
  } TConnectionResult;
                                                                                           
  #pragma pack (pop)
  
  
  #ifdef __cplusplus
  extern &quot;C&quot; {
  #endif
  
  DLLIMPORT uint16_t __cdecl OpenConnection(uint8_t            PortType, 
                                            char *             PortName, 
                                            uint32_t OnConnectSucces,
                                            uint32_t *         Handle);
                                            
  DLLIMPORT void __cdecl QueryOpenConnectionStatus(uint32_t Handle,
                                                   TConnectionResult * Result); 
  
  DLLIMPORT uint16_t __cdecl CloseConnection(uint32_t Handle);
  
                                                       
  #ifdef __cplusplus
  } // extern &quot;C&quot;
  #endif
  
  #endif //#ifndef __epMCOMLib_h_
  </code></pre>
  <p>The DLL works perfectly. For this I integrated the DLL in <em>Python ,LabWindows/CVI, C++ and Delphi</em>. <em>There is no crash in these programming languages!</em></p>
  <p>Can anyone give me any useful tips on how to further isolate or eliminate the error.
  Even if a function of the DLL has been executed and the DLL is then closed, it still causes a crash. As if it's still in memory. It feels like looking for a needle in a haystack.</p>
  <p><a href="https://i.stack.imgur.com/Gy3nS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gy3nS.png" alt="Screenshot of error" /></a></p>