Add madExcept only via commandline build?

delphi package - automated exception handling
Post Reply
uligerhardt
Posts: 14
Joined: Wed Oct 24, 2012 9:39 am

Add madExcept only via commandline build?

Post by uligerhardt »

Hi all,

I'd like to have madExcept disabled while im working in the Delphi IDE but have it enabled in a special build for our testers. How can I achieve that?
I know that I have to call madExceptPatch when compiling MSBuild and that part works. But AFACIT en-/-disabling madEcept via the Delphi Project menu works either for IDE and command line build or for none of them.
Can I control that via a $DEFINE, a dproj configuration or similar?

Best regards,
Uli
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: Add madExcept only via commandline build?

Post by madshi »

Using madExceptPatch is one thing of 3 you have to do. Here are the other 2:

(1) Make sure you compile with the correct compiler and linker options. Turn the compiler debug infos on. The linker debug options can stay turned off, except for the map file (Delphi) or TD32 debug info (BCB).

(2) The madExcept code needs to be linked into the exe, otherwise it can't work. You can do this by activating madExcept in the project settings, then move the madExcept uses clause units (or pragma links) into a conditional define. Afterwards add a comment "// dontTouchUses - this tells madExcept to don't modify your source code" above the uses clause or above the pragmas. The in the command line build, make sure the conditional define you used is activated.
uligerhardt
Posts: 14
Joined: Wed Oct 24, 2012 9:39 am

Re: Add madExcept only via commandline build?

Post by uligerhardt »

Sorry for digging up this old thread again. :-)

I tried your suggestions but didn't get it to work. Please see the attached project. I would like to configure it so that
  1. madExcept is disabled for MadExceptMSBuildTest.dproj in the IDE
  2. madExcept is enabled in the MadExceptMSBuildTest.exe produced by test.bat
  3. madExcept is disabled for MadExceptMSBuildTest.exe's produced by MSBuild with config Release
The only way I could get #2 is by having HandleExceptions=1 inside MadExceptMSBuildTest.mes. Unfortunately this defeats #1.

Best regards,
Uli
Attachments
MadExceptMSBuildTest.7z
(5.05 KiB) Downloaded 277 times
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: Add madExcept only via commandline build?

Post by madshi »

Sorry for the late reply.

You can solve the problem by telling madExceptPatch.exe to use a different MES file, one which isn't used by the IDE and which has "HandleExceptions=1" set.
uligerhardt
Posts: 14
Joined: Wed Oct 24, 2012 9:39 am

Re: Add madExcept only via commandline build?

Post by uligerhardt »

Thanks madshi,

that worked. Such a simple solution. :-)
Post Reply