Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Debug version of DLL & .LIB file

Status
Not open for further replies.

SpenBabe

Programmer
Sep 25, 2000
70
GB
How do I easily get a Debug version of a project to use a Debug version of my DLL & Release version to use a Release DLL ?

The Debug settings in my DLL project create a MyDll-debug.dll & MyDll-debug.lib & the Release settings create a MyDll.dll & MyDll.lib.

The client projects 'Link' tab has "MyDll-debug.lib" in the 'Object/Library modules' setting for Debug & "MyDll-debug.lib" for the Release build.

Everything compiles OK, but the Debug & Release versions of the client always uses the Release DLL.

I know, it's something stupid, as I've looked inside the "MyDll-debug.lib" file & seen that mentions "MyDll.dll"

Thanks in advance

Spencer Window (not a joke name)
 
try to change current configuartion
in menu Debug->SetActiveConfiguration John Fill
1c.bmp


ivfmd@mail.md
 
I've sorted it - You have to have another .DEF file with the LIBRARY directive set to match output names

In my case, 'LIBARY MyDLL-debug' to match the MyDll-debug.dll & MyDll-debug.lib files that are produced. Spencer Window (not a joke name)
 
I have done this many times:
-Name the OUTPUT file for the debug version MyDllD.dll from ProjectSettings
-Name the OUTPUT file for the release version MyDllR.dll fromProjectSettings

The compiler would then generate two .lib files MyDllD and MyDllR, which you can use as you wish.

Hope this helps,s-) Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
Using MSVC++ you can add the following statements to
your code:

#if _DEBUG
#pragma comment(lib, "MyDll-debug.lib")
#else
#pragma comment(lib, "MyDll.dll")
#endif

You may add a library path if necessary.

-- ralf
 
Thanks 'rpet', but where exactly do you put these lines of code ? Spencer Window (not a joke name)
 
It's normally a good idea to put these line right
before including the header files.

-- ralf
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top