Graphics32 driving me nuts

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Post Reply
uuderzo
Posts: 4
Joined: Sun Mar 15, 2015 4:19 pm

Graphics32 driving me nuts

Post by uuderzo »

Hello all!

I have an old C++ Builder project that i want to rebuild with BCB XE8.
This project relies on Graphics32 library, which is a Dephi project. I wanted to update to most recent version of the library, but having upgraded only the C++ builder personality to XE8 i managed to build the Delphi packages with MsBuild from the command line and install the debug package into the IDE.

My code builds successfully but at runtime, when i instantiate a new TTagBitmap (extended from Graphics32 TBitmap32) i get an access violation exception right in the constructor. Looks like if the super class TBitmap32 is not allocated in some way, and everything crashes.

My code:

Code: Select all

class TTagBitmap: public TBitmap32 {
public:
	TTagBitmap( TColor32 col, TColor32 col2 );
};

Code: Select all

TTagBitmap::TTagBitmap( TColor32 col, TColor32 col2 ) {
(...)
}
At runtime it breaks just entering the TTagBitmap constructor, like if it wasn't able to build correctly the TBitmap32.
Tried also to explicitly call the TBitmap32 constructor (now it calls the default constructor) but nothing changes.

With pre 1.5 Graphics32 there were no problem at all, but now i'm stuck into a loop.

Any help would be wonderful.
Thanks! Umberto
uuderzo
Posts: 4
Joined: Sun Mar 15, 2015 4:19 pm

Re: Graphics32 driving me nuts

Post by uuderzo »

So... looks like i work-arounded the issue.

The problem is that i extended in C++ the TBitmap32 Delphi class, for encapsulating specialized bitmap graphics.
This doesn't work and leads to the access violation exception during object costruction.
So i've tried not to exted TBitmap32 and use as is. This works correctly.
My guess is that there is some kind of inconsistency in the constructor chain, bit i fear i'm not enough skilled in Delphi to C++ class extension to grasp it.

I'll keep using the non extended TBitmap32, but any hint on this issue would be welcomed.

Cheers! Umberto
Post Reply