Settings in Code

delphi package - automated exception handling
Post Reply
etwoss
Posts: 23
Joined: Thu Aug 04, 2016 11:45 am

Settings in Code

Post by etwoss »

Hi

I want to set all values in code.

Inly the Basis settings (except WindowsLogo) look like read only:

MESettings.LinkInSettings := False; // link in madExcept settings
MESettings.LinkInMapFile := False; // link in function names and line numbers

// runtime checks
MESettings.CheckFileCrc := False; // check whether binary file is corrupt (via crc)
MESettings.CheckForFreeze := False; // check for frozen main thread


// active error search
MESettings.ReportLeaks := False; // report resource leaks
MESettings.CrashOnOverrun := False; // instantly crash on buffer overrun
MESettings.CrashOnUnderrun := False; // instantly crash on buffer underrun

All these Boolean give compilation error "Left Side can't be assigned to"

Eric
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Settings in Code

Post by madshi »

Most of these settings define what happens at compile time. Because of that you can only read them at runtime, but not change them. For example, the LinkIn settings define which information is added to your EXE file at compile time. And the active error search options require the use of a custom memory manager, so turning these options on/off on the fly doesn't really work.

You can change the CheckForFreeze stuff, though. There are APIs available for that, see "PauseFreezeCheck()", "ImNotFrozen()" and "SetFreezeTimeout()".

My recommendation to you would be to link in some reasonable default settings into the EXE file, but then to change everything that makes sense at runtime.
etwoss
Posts: 23
Joined: Thu Aug 04, 2016 11:45 am

Re: Settings in Code

Post by etwoss »

Hi

I checked the EXE with a Resource Editor
i found two entries
MAD CALIBRATE Language Neutral
MAD EXCEPT Language Neutral


Are these the one's which are added to the exe when compiling?
And how to add them if you only use the Command Line Delphi compiler ?

Eric
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Settings in Code

Post by madshi »

Yes, and there's also an addition "form" added to the resource section, which contains the madExcept settings.

When using command line compiling, you need to run "madExceptPatch.exe" manually, after compilation has completed. Pass the exe file and "mes" (madExcept settings) file with full path as parameters to madExceptPatch.
rcuevas
Posts: 3
Joined: Mon Nov 28, 2016 11:27 am

Re: Settings in Code

Post by rcuevas »

Hello,

I'm trying to deal with this "issue" in Borland C++.

I have included the line #include <madExcept.h> and, therefore, I have access to MESettigns() and I obtain a pointer that I can use to set and get some information. But, I don't see none of the next options: PauseFreezeCheck()", "ImNotFrozen()" and "SetFreezeTimeout()". How should I proceed?

Thanks for your help.

Raúl.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Settings in Code

Post by madshi »

These are actual functions which are exported by madExcept.pas, they are not part of the IMESettings interface.
rcuevas
Posts: 3
Joined: Mon Nov 28, 2016 11:27 am

Re: Settings in Code

Post by rcuevas »

Hello again,

Thanks for the quick answer. But, then, how should I manage this situation? How can I call these functions?

Regards.
altxt
Posts: 17
Joined: Thu Nov 24, 2016 3:47 pm

Re: Settings in Code

Post by altxt »

Sorry if I'm intruding, especially since I don't have C++ Builder installed, but this seems easy enough to answer.

rcuevas, just call them. Something like
#include <madExcept.hpp>
...
PauseFreezeCheck();
rcuevas
Posts: 3
Joined: Mon Nov 28, 2016 11:27 am

Re: Settings in Code

Post by rcuevas »

Hello Altxt,

Yes, it worked. I didn't realize that I could call directly to those methods, whithout the need to use an intermediate object.

Thanks for your help.
Post Reply