Is there a macro I can use for checking the current configuration type in visual studio?
Depending on the current setting I’d like to either include a main or dllmain function:
#IFDEF CONFIGURATION_TYPE_EXE
int main(int argc, char **argv)
{
...
}
#ELSEIF CONFIGURATION_TYPE_DLL
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}
#ENDIF
If it’s a DLL project, the
_USRDLLwill be defined. (see Configuration Properties\Preprocessor\Preprocessor definitions).Be careful though, because the list is filled by wizard and will not update automatically if the project was created as something else and then configured as DLL. Also, you have to be careful if you are building a lib to be linked with a DLL.