LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exception: Access violation (0xC0000005) at with dll

I am working with a Labview program that calls a dll and I am getting frequent crashes of this type: Exception: Access violation (0xC0000005) at EIP=0x00A2266A.

I get this even with a simple vi that only uses a dll function that takes no parameters. The same dll and functions are imported and used by a C# program with little if any problems. Is there a good way to narrow down and resolve this problem?

0 Kudos
Message 1 of 8
(4,716 Views)

What exactly is the dll doing? Knowing this will give us a bit of an idea of what to look for.

 

If it is LabVIEW that is crashing, make sure you send in the crash to NI.  If you take a look at the lvlog.txt that is in the .zip file that's created you might get a better idea of what LabVIEW thinks the problem is.  At this point though I think we need to know more about what this dll is actually doing, especially when passing nothing into the parameters.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 8
(4,697 Views)

The dll interfaces with an FTDI module to implement a SPI interface. The dll works in a C# program so I am more focused on the Labview side of it. I have sent in several of the crash reports. I attached the crash info.

Download All
0 Kudos
Message 3 of 8
(4,676 Views)

It would be much more helpful if you attach your VI, the header file for the DLL, and any available documentation. If you're using a DLL you wrote yourself for testing, attach the code for that as well. The crash logs aren't very useful (at least to anyone outside NI, which is the case for most forum users).

 

There are many threads in this forum on using FTDI drivers in LabVIEW. Have you checked if someone has already posted working sample code?

0 Kudos
Message 4 of 8
(4,668 Views)

I have attached one of my VIs and below is an excerpt from the header file that relates to the VI dll function. The dll communicates with a device and the FTDI module just provides the SPI link. The dll and SPI end seems to work well in the C# application.

 

FUNC_DECLSPEC int EglTest_Init();

 

0 Kudos
Message 5 of 8
(4,649 Views)

I can't open your VI at the moment (still on LabVIEW 2012). A couple of questions though:

- have you confirmed that you're using the correct calling convention (stdcall versus C)?

- do you have the source for the DLL you're calling? If so, can you hook up a debugger to the DLL while you're running the VI in LabVIEW?

- in the Call Library Function Node configuration, have you tried increasing the error checking level? Sometimes this produces a more helpful error message.

- Does this VI crash every time you run it, or just sometimes?

- Is your LabVIEW application doing EXACTLY the same thing as the C# application? Often, DLLs require that the functions inside be called in a particular order, and will crash if that order isn't respected.

0 Kudos
Message 6 of 8
(4,641 Views)

I am fairly sure calling convention is correct. The other way does not work at all. I think I have the source code but have not looked at it closely yet. The VI does not crash every time it runs. It will sometimes run for multiple test device cases. I did try increasing the error level checking and it did not provide anything more. Yes, the LabVIEW applicatiobn is doing the same thing and a VI that only calls the init function of the dll behaves similarly.

0 Kudos
Message 7 of 8
(4,625 Views)

Does your C# application that has "little if any problems" crash, even infrequently, in the same way? Is it running on the same machine as the LabVIEW program?

 

Did you configure the Call Library Function Node to run in the user interface thread, or in any thread? Try setting it to run in the user interface thread.

 

You said that sometimes it will run for multiple test cases without crashing. Does it always crash on the same function call (the Init function you mentioned in a previous post) or does it crash on several different functions? For that matter, does it ever crash on that Init function, or does it crash somewhere else?

0 Kudos
Message 8 of 8
(4,613 Views)