Looking for compiler macro to skip #pragma comment(lib,"filename.lib")

  • Thread starter Thread starter hector santos
  • Start date Start date
H

hector santos

Guest
This is like a chicken and egg issue and I am trying to avoid having to create another compiler macro.

I have a dll, example, wcdns.cpp with a wcdns.h interface header structures and function prototype statements and an import lib statement using the comment lib pragma.

The problem is when compiling wcdns.cpp the first time, i.e. after a clean, the wcdns.lib is missing so you get a link "missing wcdns.lib" missing. One way to resolve this is to set a preprocessor macro for the dll project:

"MAKE_WCDNS"

and then wrap this around the #pragma in wcdns.h


#ifndef MAKE_WCDNS
# ifdef _WIN64
# pragma comment(lib,"wcdns64.lib")
# else
# pragma comment(lib,"wcdns.lib")
# endif
#endif



Now other projects can use the wcdns.h and the main wcdns.cpp compile/link won't barf.

My question, I have to repeat this for multiple DLLs, is there a built in macro that is set that will signal the DLL is being created? Of course, I can add the wcdns.lib to all the other projects link setup, but I have to many project configurations, I just want to deal with the main wcdns.cpp and not worry about other projects.

Is there another technique?

Thanks



Hector Santos, CTO Santronics Software, Inc. Santronics Software, Inc.

Continue reading...
 
Back
Top