LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Good DLL Habits - Debug vs Release

I've been setting up my CVI projects to include both the debug and release DLL libs. When I want to debug, I enable the debug libs.

Is there a better way to do things?

Also, is there a way I can programmatically exclude the debug libs?

Message Edited by IBNobody on 03-01-2007 09:08 AM

0 Kudos
Message 1 of 10
(5,654 Views)
You can use _CVI_DEBUG_ and _CVI_EXE_ macros automatically defined in the IDE depending on Build >> Configuration option you choose. These and other useful macros are listed in Build Options panel. Some discussion can be found searching the forum for these keywords: as an example look at this thread or this other one.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 10
(5,627 Views)
Using macros wasn't what I meant. That won't help.

group.lib points to group.dll
group_dbg.lib points to group_dbg.dll

If I want the option to use release and debug DLLs in my parent app, I currently have to add both the .lib and the _dbg.lib to my project and disable one manually. (Right click, toggle exclusion from build.) I was asking if there was an easier way of doing this.
0 Kudos
Message 3 of 10
(5,613 Views)
Oh, I understand.
Unfortunately I don't know a solution to do this automatically.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 10
(5,606 Views)
IBNobody said the following on 2007/03/02 15:10:
> Using macros wasn't what I meant. That won't help. group.lib points
> to group.dllgroup_dbg.lib points to group_dbg.dllIf I want the option
> to use release and debug DLLs in my parent app, I currently have to
> add both the .lib and the _dbg.lib to my project and disable one
> manually. (Right click, toggle exclusion from build.) I was asking if
> there was an easier way of doing this.

In your [Build][Target settings] menu, just remove the _dgb off the file
name of the debug version... ?

--
Guillaume Dargaud
http://www.gdargaud.net/
0 Kudos
Message 5 of 10
(5,536 Views)
Hello IBNobody,

Have you looked into using a pre-build step for this? If I understand your problem correctly, here's how you could do it:

1. Keep a master copy of each lib/dll in subdirectories below your project directory. The two sets of files should have the same name.
2. Your project includes the lib from the project directory -- not from the subdirectory.
3. Create a pre-build step (Build>>Build Steps) that will copy the lib and dll from the appropriate subdirectory up to the project directory. You can either create different steps for each configuration, or you can create the same step and use the %CVIBUILDCONFIG% variable to tell you which configuration your building.

Luis
0 Kudos
Message 6 of 10
(5,531 Views)
What I decided to do was just use the exclusion toggle. 95% of the time, I debug my main code using release versions of the DLLs. When I need to use the debug versions, I switch over.

Using the debug versions adds a ton of overhead that I don't need unless I have a problem that requires me to dig deeply into the code.
0 Kudos
Message 7 of 10
(5,455 Views)

Hello,

 

Is there something new to switch libs between configurations using LabWindows/CVI 2009?

I have exactly the same problem, I would like to switch automaticly the lib used for debug 32bits, release 32bits, debug64bits and release 64bits.

 

Best regards,

Yannick Willener

Message Edited by YannickW on 04-30-2010 09:09 AM
0 Kudos
Message 8 of 10
(4,734 Views)

There's a new indicator in the bottom right corner of the CVI frame to tell you what config you're in. 

 

I never have been able to figure out how to get CVI to switch automagically between debug and release librararies for a DLL.  It does seem like CVI should be able to do it, given all the other things it manages behind the scenes for you.  

 

Menchar 

0 Kudos
Message 9 of 10
(4,698 Views)

Hello Yanick,

 

CVI can switch intelligently between 32- and 64-bit libs in your project, but unfortunately there's still no mechanism for switching between debug and release libs.

 

If your 32- and 64-bit libs have different names, then you can simply add them both to the project and CVI will use whichever lib has the same bitness as your current build configuration.

 

If they have the same name, you can only have one of them in the project at one time, since CVI will not allow you to add two files with the same name in the project. But if you place the 32-bit lib in a folder named "msvc" and the 64-bit lib in a folder named "msvc64", and the two folders are next to each other, you can add either of the two libs to the project and CVI will switch internally between each one depending on your build configuration. Other valid arrangements would be to put the 32-bit lib in the parent folder and the 64-bit lib in a sub-folder named "msvc64", or you could put the 64-bit lib in the parent folder and the 32-bit lib in a sub-folder named "msvc".

 

As far as debug vs. release is concerned, your options are still to either use some mechanism involving build steps, like I had suggested earlier, or to dispense with libs altogether and switch to dynamic loading of your DLL. That would allow you to use the _CVI_DEBUG_ macro that Roberto had mentioned earlier to select which DLL to pass to the LoadLibrary function.

 

Luis

0 Kudos
Message 10 of 10
(4,688 Views)