Page 1 of 1

madExcept causes compilation errors in Delphi 10.2

Posted: Sun May 28, 2017 12:05 am
by tkunicki
We treat uninitialized variable warning as an error which makes impossible madexcept to compile under Win64 because of invalid way of casting used which is triggering warnings now

NativeUInt(sh) := NativeUInt(mh) + sizeOf(TImageNtHeaders64)

Instead of casting left side you should cast right side to pointer this will not trigger compiler warning.

sh := Pointer(mh + sizeOf(TImageNtHeaders64))

It does not have to be typed pointer. The problem appears in madExcept.pas and in madMapFile.pas

Re: madExcept causes compilation errors in Delphi 10.2

Posted: Sat Jun 03, 2017 10:50 am
by pfennig59
We ran into the same problem and I too would prefer to do the casting only on the right side.

Although, it should be
sh := Pointer(NativeUInt(mh) + sizeOf(TImageNtHeaders64)) ,

otherwise you'll get an error E2015: Operator not applicable to this operand type

It also affects unit madTools.pas from the madBasic package.

Re: madExcept causes compilation errors in Delphi 10.2

Posted: Wed Jun 14, 2017 8:56 am
by madshi
Somewhat strange. These warnings don't seem to show up if I batch compile madExcept. I'm wondering why you're recompiling madExcept.pas, anyway? Why not simply using the precompiled DCUs I'm shipping with madExcept.

Anyway, I'll have a look at these warnigs. Although I have to say, they don't make sense to me. IMHO the code "NativeUInt(sh) := NativeUInt(mh) + sizeOf(TImageNtHeaders64)" is perfectly fine!