Page 1 of 1

Settings in Code

Posted: Wed Aug 31, 2016 6:31 am
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

Re: Settings in Code

Posted: Wed Aug 31, 2016 7:30 am
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.

Re: Settings in Code

Posted: Fri Sep 02, 2016 7:08 am
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

Re: Settings in Code

Posted: Fri Sep 02, 2016 7:30 am
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.

Re: Settings in Code

Posted: Mon Nov 28, 2016 11:33 am
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.

Re: Settings in Code

Posted: Mon Nov 28, 2016 11:45 am
by madshi
These are actual functions which are exported by madExcept.pas, they are not part of the IMESettings interface.

Re: Settings in Code

Posted: Mon Nov 28, 2016 1:18 pm
by rcuevas
Hello again,

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

Regards.

Re: Settings in Code

Posted: Tue Nov 29, 2016 12:51 pm
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();

Re: Settings in Code

Posted: Tue Nov 29, 2016 1:25 pm
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.