08-27-2009 10:26 AM
Hi,
I've been having this problem for a while now and I've managed to work around it, but it is now critical. In older versions of CVI (6.0?) I could create a debug dll, then create a debug executable that built in the debug dll. I could then put break points in the executable and trace code into the dll function calls as I stepped through. I can no longer do this. If they are both in debug mode, the executable freezes on standard calls like SetCtrlVal. If I have the dll in debug mode and the executable in release mode, the breakpoints I put in the dll are skipped over when I run the executable. What's going on?!?!?
Judy
08-27-2009 11:12 AM
If I want to debug a CVI 7.1 dll, I switch to that project and build a debug version. Then specify an external process to run it (some exectuable; this does not have to be a debug one or even a CVI one), set my breakpoints and it all works as expected. I haven't noticed the symptoms you describe - what version of CVI are you using now?
JR
08-27-2009 11:16 AM
Hi JR,
Thanks for responding. I'm using version 9.01. The external process builds in the dll. I build the debuggable dll, build the external process that uses it in debug mode, then run the external process and get freezes. I've tried building the external process in release mode incorporating the debug dll and that doesn't work either.
Judy
08-27-2009 12:55 PM - edited 08-27-2009 12:59 PM
A couple of thoughts -
It sounds like you are, but I'll ask - are you building using the debug version of the import library when you use the debug version of the DLL? It's easy to get these confused and CVI will not automagically switch the import libraries when you switch the DLL's mode from release/debug. I think I've managed to build an app with the release mode import library and tried running with the debug build of the DLL (or vice versa) and have seen similar symptoms.
Another thing that can be confusing when running an application in release mode is the DLL search path - are you certain that you have only the intended version of the DLL present, and that the application is finding that specific DLL? This can drive you nuts - I've had to go in and rip out every instance of a DLL to make sure the app loaded the one I intended - the DLL path search algorithm is complex and varies by OS type and version and you can even re-direct the DLL search path so it can get even weirder. Depending upon where you put the application executable, it may not be loading the version of the DLL you think it is. I'm guessing that you're doing a "static" load at application startup (implicit load) rather than using LoadLibraryEx or equivalent.
Menchar
08-28-2009 06:26 PM
I have been able to debug DLLs in CVI 9.01 the same way I did in CVI 6.0.
Have two projects in your workspace, one project for your DLL and the other for your EXE.
When I build both as debug, I can set breakpoints in either project. The program stops at my breakpoints and I can single-step or continue from there. With both projects built as debug in CVI 9.01, it doesn't matter which project is my active project: the breakpoints are active in either case.
If I build my exe as release, and I have my exe project as the active project, breakpoints are not recognized in my debuggable DLL. But when I set my DLL as the active project, and specify my release exe as the Executable to Debug, my breakpoints in my debuggable DLL are still recognized.
I also don't have any problems with SetCtrlVal in my DLL.
All these comments are based on my observations running CVI 9.01.
If you want another project to try, look at the example titled ChillerTestExecDemo.zip I posted here. http://forums.ni.com/ni/board/message?board.id=180&thread.id=42653&page=2
Load the CWS file so you get both projects in the same workspace. Both projects are currently set to Debug. For you purposes, the most interest things will happen in you click on Run Chiller Interactive on the main panel. That's the callback the uses SetCtrlVal. You can set breakpoints in either project and see what happens.
Here's some menu navigation in CVI 9.01 you probably already know.
To select the active project when you multiple projects in your workspace, from the project window, go to File >> Set Active Project.
With your DLL project as the active project, to run your executable, from the project window, go to Run >> Specify Executable to Debug.
For the example project I pointed you to, ChillerControl is the DLL project, and ChillerDemoTestExec is the exe project. I originally built and debugged it in CVI 6.0, but I just tried it in CVI 9.01 and had no problems.
Try debugging my example and let me know what happens.
08-31-2009 07:47 AM
Hi Al,
This is exactly what I'm doing with my project and it's not working. Is there some registry variable or other setting that might interfere with the ability to debug both projects (dll and external exe)? I used to be able to do this with CVI 6.0 but no more. Perhaps some setting got corrupted or changed when we installed the latter version.
Judy
08-31-2009 08:02 AM
Judy:
Have you tried debugging my posted example I referred you to earlier? Could you debug that?
Can you post your project, or cut it to the bare minimum and post it?
What Debug Options do you have selected? In CVI 9.01 go to Options >> Environment and look at the debug sections.
I've attached a JPG showing the options I have set.