tappatappa Posted September 25, 2015 Share Posted September 25, 2015 I was wondering whether is possible to write a c++builder project (.cbproj) where you can produce a Stand-Alone Application (.exe) with the Debug Configuration, and a ISAPI DLL with the Release Configuration. Currently I work with two separate projects but this is painful because when I add a new unit to the "Debug project" I have to remember to add it to the "Release project", too. This rarely happens, of course, and causes all sorts of problems during release (compiling/linking/runtime errors...) Beside auto-generating the .cbproj, what alternatives do I have? Quote Link to comment Share on other sites More sharing options...
tappatappa Posted September 25, 2015 Author Share Posted September 25, 2015 ok I wrote a shell script that generates the cbproj file sed -e 's/<AppType>Application<\/AppType>/<AppType>Library<\/AppType>/g' \ -e "s/<Config Condition=\"'\$(Config)'==''\">Debug<\/Config>/<Config Condition=\"'\$(Config)'==''\">Release<\/Config>/g" \ -e 's/<ProjectType>CppVCLApplication<\/ProjectType>/<ProjectType>CppManagedDynamicLibrary<\/ProjectType>/g' \ -e 's/<Borland\.ProjectType>CppVCLApplication<\/Borland\.ProjectType>/<Borland.ProjectType>CppManagedDynamicLibrary<\/Borland.ProjectType>/g' \ -e 's/<ProjectGuid>{[a-zA-Z0-9\-]*}<\/ProjectGuid>/<ProjectGuid>{3D9AD1F9-86F9-468A-AE84-AA46B52285E8}<\/ProjectGuid>/g'\ < myproject.cbproj > myproject_DLL.cbproj plus you need to put some #ifdef here and there, especially in the MainSource (myproject.cpp) #ifdef MYPROJECT_DLL #include <ActiveX.hpp> #include <ComObj.hpp> #include <UniGUIISAPI.hpp> #include <Isapi2.hpp> #else #include <UniGUIVars.hpp> #endif //.....USEFORM..... #ifdef MYPROJECT_DLL #pragma link "uniguiisapi.obj" #else #pragma link "UniGUIVars.obj" #pragma MyProject #endif #pragma package(smart_init) #ifdef MYPROJECT_DLL #define __DLL_OBFUSCATE(a, a##b //--------------------------------------------------------------------------- int WINAPI __DLL_OBFUSCATE(DllEnt,ryPoint) (HINSTANCE hinst, unsigned long reason, void*) { try { if (reason == DLL_PROCESS_ATTACH) { CoInitFlags = COINIT_MULTITHREADED; } } catch (Exception &exception) { } return 1; } //--------------------------------------------------------------------------- extern "C" { BOOL __declspec(dllexport) WINAPI GetExtensionVersion(Isapi2::THSE_VERSION_INFO &Ver) { return Uniguiisapi::GetExtensionVersion(Ver); } //--------------------------------------------------------------------------- unsigned __declspec(dllexport) WINAPI HttpExtensionProc(Isapi2::TEXTENSION_CONTROL_BLOCK &ECB) { return Uniguiisapi::HttpExtensionProc(ECB); } //--------------------------------------------------------------------------- BOOL __declspec(dllexport) WINAPI TerminateExtension(int dwFlags) { return Uniguiisapi::TerminateExtension(dwFlags); } } #else //--------------------------------------------------------------------------- WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { try { Forms::Application->Initialize(); Uniguivars::CreateServerModule(__classid(TUniServerModule)); Application->Run(); } catch (...) { } return 0; } #endif Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.