Settings in Code

delphi package - automated exception handling

Settings in Code

Postby etwoss » Wed Aug 31, 2016 6:31 am

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
etwoss
 
Posts: 23
Joined: Thu Aug 04, 2016 11:45 am

Re: Settings in Code

Postby madshi » Wed Aug 31, 2016 7:30 am

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.
madshi
Site Admin
 
Posts: 9411
Joined: Sun Mar 21, 2004 5:25 pm

Re: Settings in Code

Postby etwoss » Fri Sep 02, 2016 7:08 am

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
etwoss
 
Posts: 23
Joined: Thu Aug 04, 2016 11:45 am

Re: Settings in Code

Postby madshi » Fri Sep 02, 2016 7:30 am

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.
madshi
Site Admin
 
Posts: 9411
Joined: Sun Mar 21, 2004 5:25 pm

Re: Settings in Code

Postby rcuevas » Mon Nov 28, 2016 11:33 am

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.
rcuevas
 
Posts: 3
Joined: Mon Nov 28, 2016 11:27 am

Re: Settings in Code

Postby madshi » Mon Nov 28, 2016 11:45 am

These are actual functions which are exported by madExcept.pas, they are not part of the IMESettings interface.
madshi
Site Admin
 
Posts: 9411
Joined: Sun Mar 21, 2004 5:25 pm

Re: Settings in Code

Postby rcuevas » Mon Nov 28, 2016 1:18 pm

Hello again,

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

Regards.
rcuevas
 
Posts: 3
Joined: Mon Nov 28, 2016 11:27 am

Re: Settings in Code

Postby altxt » Tue Nov 29, 2016 12:51 pm

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();
altxt
 
Posts: 10
Joined: Thu Nov 24, 2016 3:47 pm

Re: Settings in Code

Postby rcuevas » Tue Nov 29, 2016 1:25 pm

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.
rcuevas
 
Posts: 3
Joined: Mon Nov 28, 2016 11:27 am


Return to madExcept

Who is online

Users browsing this forum: No registered users and 3 guests