LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I get a GPF when I call a DLL function from a Panel Callback (in WinMain), but not when called directly from WinMain

Hi Josh,

 

I tried running the program you sent and I get an error popup “PS_Main_dbg.exe – Entry Point Not Found with the message The procedure entry point DeleteTableCellRangeRingItems could not be located in the dynamic link library cvirte.dll”, followed by popup “Fatal Run-time Error, The external process failed to load properly.  Verify that all DLLs used by the debuggee were installed in the path.”.  Also, I noticed you added the ps6624_dll project to the PS_Sim workspace.  Perhaps that is why it worked for you.

 

Attached is a simpler version.  I found that if I get the device handle from WinMain and then try to access the device using this handle from the CVICALLBACK I get the GPF.  When I get the device handle and access the device from the same location (WinMain or the Callback) it works fine.  I added a readme.txt file to PS_Main that explains the project objectives.

0 Kudos
Message 11 of 20
(2,020 Views)

Jim,

When should I be seeing the GPF?  When I press the 'on' button? 

Because I ran PS_Main_dbg.exe that you sent, and it works just fine.  I can toggle the button on and off without error.  Am I doing something wrong?

Josh W. | National Instruments | Applications Engineering

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 12 of 20
(1,991 Views)

When the Test button is pressed (ON or OFF) the cvicallback calls the Command_SetNomVolt function, which loads the ps6624_dll.lib and calls the SubDLL function ps6624_VoltageLevel function.  In the SubDLL I call the IVI function hp662xa_ConfigureVoltageLevel().  It is at this point I get the GPF.

 

Thanks,

 

Jim

0 Kudos
Message 13 of 20
(1,984 Views)
Hi Jim,

Josh is out of the office this week teaching, so I will be helping you out.  We have tested this out on CVI 8.0.1 and it runs fine.  What version of CVI are you using? 
0 Kudos
Message 14 of 20
(1,948 Views)
I'm using version 7.0.0 with Windows XP.
0 Kudos
Message 15 of 20
(1,933 Views)
Hi Jim,

We still haven't been able to duplicate this GPF error on our side.  Have you tried this on another computer to see if it behaves the same way?
0 Kudos
Message 16 of 20
(1,915 Views)

Hi Terry,

 

I tried running the Simple_IVIGPF on another PC (Windows XP) and still get the GPF when the IVI function is called from the SubDLL.  I’ve tried changing the MainDLL and SubDLL image base addresses (Build Options) to avoid collisions, plus explicitly declared function as __stdcall.  Are there any other CVI environmental features I may be overlooking?

 

FYI I will be out next week.

 

Thanks,

 

Jim

0 Kudos
Message 17 of 20
(1,894 Views)
Hi Jim,

There are no other features that I can think of to change.  You could try to download the CVI 8.0.1 evaluation to see if you receive the same error with the latest version of CVI.  You can download it at: CVI Evaluation.  Let me know if you still receive the GPF error with version 8.0.1.
0 Kudos
Message 18 of 20
(1,876 Views)

Hi Terry,

 

I tried using the CVI evaluation version 8.0.1 with the same result (GPF).  Is there a specific version of the IVI Compliance Package, NI-VISA, or any other associated software I may need loaded on my PC?

 

Thanks,

 

Jim

0 Kudos
Message 19 of 20
(1,815 Views)
Hi Jim,

I have IVI Compliance Package 2.5 and NI-VISA 4.0.  Install those versions and try calling the .dll again.  Let me know how it works.
0 Kudos
Message 20 of 20
(1,799 Views)