madExcept not working on 64 bit build

delphi package - automated exception handling
Post Reply
santiago
Posts: 73
Joined: Thu May 05, 2016 6:01 pm

madExcept not working on 64 bit build

Post by santiago »

Hi madschi,

not too long ago we purchased the company license for madExcept.
Just ran into one problem.
We are now switching from XE-2 to XE-10.

madExcept works well in XE-10 Win32 builds.
We just created a Win64 build of our software (XE-10 only).
The problem is that the madExcept box does not appear, but the standard delphi exception box shows up.
The source code for Win32/Win64 is basically the same. Win64 is just a new build configuration.

We can build our software with the Delphi IDE (XE-10) or via MS-BUILD. For the later case we use the madExceptPatch.exe tool.
madExcept works well for Win32 version (IDE or MS-Build built), but the Win64 build does not work in either case.

We manually link in the madExcept code in our base package (bpl) and distribute the madExcept bpl's along with our product:

Code: Select all

requires
...
  madBasic_,
  madDisAsm_,
  madExcept_;
I looked in the registry [HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\17.0\Known Packages] and found this:
Image

I imagine these entries originate from the madCollection installer. They do refer to the 32 bit versions of the bpl.
Maybe this is somehow causing a conflict? I don't think so (as they are irrelevant for MS-BUILD) but I can't think of any thing else.

Any idea what could be wrong? Does anything specific need to be done to enable madExcept for Win64 builds?

Thank you!

** EDIT **

The build configurations settings are identical except for the obvious x86-x64 differences.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept not working on 64 bit build

Post by madshi »

Have you tried compiling within the IDE as a test to check if it's working correctly then?

The "Known Packages" are those loaded by the IDE and the IDE is a 32bit process, so everything is correct there.

When compiling with MS-Build, you need to manually make sure that the compiler and linker options are set correctly. Basically you need to enable most of the compiler debug switches (except for stack frames, which are not needed), but you can disable all the linker debug options. Except for the map file which needs to be set to detailed.

One thing worth trying:

1) Create an empty file "madExceptWizard.txt" on your desktop.
2) Run madExceptPatch.exe as you usually do for the 64bit build.
3) Zip the text file and attach it here, then I can have a look.
santiago
Posts: 73
Joined: Thu May 05, 2016 6:01 pm

Re: madExcept not working on 64 bit build

Post by santiago »

Hello madshi,

yes the problem happens if we compile from either the IDE or via MS-BUILD. 32 bit builds work fine in either case.

I did the following.
I copied the following files into a folder which I will upload for you:

madExceptPatch.exe
CoreBpl.mes (MES file we use for the Core.bpl file which required _madExcept,bpl)
Corex64.map (linker map file generated for 64 bit build)
Corex86.map (linker map file generated for 32 bit build)
madExceptWizard.txt (empty file which needs to have the map file appended to it)

I opened a command prompt and cd'd into this folder.
I then ran:

Code: Select all

C:\Temp\deleteMe\madExcept>madExceptPatch.exe madExceptWizard.txt CoreBpl.mes Corex64.map
Result:
map file appended

Code: Select all

C:\Temp\deleteMe\madExcept>madExceptPatch.exe madExceptWizard.txt CoreBpl.mes Corex86.map
Result:
map file appended

however in both cases the madExceptWizard.txt remainded 0 bytes in size.

You can download the zipped folder from here:
https://www.dropbox.com/s/nfjxytqa7lsw7 ... t.zip?dl=0

Thx!
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept not working on 64 bit build

Post by madshi »

Please don't add madExceptWizard.txt as a parameter to madExceptPatch. Simply run madExceptPatch exactly the same way as you always did. Does the madExceptWizard.txt file fill then?
santiago
Posts: 73
Joined: Thu May 05, 2016 6:01 pm

Re: madExcept not working on 64 bit build

Post by santiago »

Hello madschi,

got it ;-).

Here is the link to the file. This is after compiling with MS-BUILD and running madExceptPatch.exe as part of the build process.

I ran it twice one for 64 bit build and once for 32 bit build.

64-bit:
https://www.dropbox.com/s/qc8o40rl2c9x4 ... 4.txt?dl=0

32-bit:
https://www.dropbox.com/s/xmm06ued3x4et ... 6.txt?dl=0

Thanks!
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept not working on 64 bit build

Post by madshi »

Ok, now can you please send me (madshi (at) gmail (dot) com) your 32bit + 64bit EXEs and BPLs (those BPLs where you've enabledmadExcept)? I don't plan to actually execute them I just need to look at their resource sections and dll imports. Please RAR them, with a password that also encrypts the file names, then rename the extension to .dat, otherwise gmail will refuse to accept the attachment. Thanks!

P.S: I mean everything full patched with madExceptPatch.exe, so that you *think* they should work, but only the 32bit works but not the 64bit.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept not working on 64 bit build

Post by madshi »

Ok, having checked all your files, it all looks "correct" to me, so right now I've no idea why exception catching doesn't seem to work. Have you tried raising a simple test exception, e.g. a "raise Exception.Create('test')" in a button click event? That doesn't work, either?

Is there any chance you could try to reproduce this problem in a brand new test project somehow? If I could reproduce it on my PC, it should be easy to fix.
santiago
Posts: 73
Joined: Thu May 05, 2016 6:01 pm

Re: madExcept not working on 64 bit build

Post by santiago »

Hello madschi,

yes I that is exactly how I was testing :-)

Code: Select all

procedure TApplicationManager.CloseActiveJob;
begin
  raise Exception.Create('Testing madExcept');
In 32 bit builds the madExcept box shows, but not on the 64 bit build.

Am relieved that all seems to be correct, as I have double checked everything multiple times trying to find the error.

I will create a new test groupproject setup in a similar way. Hopefully I can reproduce the error there.
I'll get back to you as soon as I have something.

Thx!
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept not working on 64 bit build

Post by madshi »

Great - let me know!
santiago
Posts: 73
Joined: Thu May 05, 2016 6:01 pm

Re: madExcept not working on 64 bit build

Post by santiago »

madschi,

I just emailed you a sample project. In that project the 32 bit build works fine, however the madExcept box does not show up on the 64 bit build.

Thanks!!
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept not working on 64 bit build

Post by madshi »

Thanks, I received the email. Might take a couple of days until I find time for this, though. Busy with some other stuff atm.
santiago
Posts: 73
Joined: Thu May 05, 2016 6:01 pm

Re: madExcept not working on 64 bit build

Post by santiago »

Hello madschi,
have you had any chance to look into the issue yet? Were you able to reproduce it?

Thx!
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept not working on 64 bit build

Post by madshi »

Sorry for taking so long. Was busy with another task which I wanted to complete first.

So here's a new build, which I think should fix the problem:

http://madshi.net/madCollectionBeta.exe (installer 2.7.15.6)

It was a simple 1-line-fix... :oops:
santiago
Posts: 73
Joined: Thu May 05, 2016 6:01 pm

Re: madExcept not working on 64 bit build

Post by santiago »

I installed version 2.7.15.6 and it now works.

Thanks!!!
Post Reply