Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: Does BCB support _set_purecall_handler()?



Permlink Replies: 2 - Last Post: Aug 11, 2017 1:58 AM Last Post By: Andrew Bond Threads: [ Previous | Next ]
Andrew Bond

Posts: 183
Registered: 3/8/00
Does BCB support _set_purecall_handler()?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 10, 2017 10:29 AM
My C++ app is crashing with a call to a pure virtual function.

I would like to install my own handler for the call, which I know is possible with MSVC using:

_set_purecall_handler()

But I can't find this in the <stdlib> supplied with C++Builder (I've looked at the code that comes with Berlin).

Does anyone know if this function is supported by C++Builder or - if not - another way of intercepting the pure virtual function call.

Thanks in anticipation.

Andrew
Remy Lebeau (Te...


Posts: 8,950
Registered: 12/23/01
Re: Does BCB support _set_purecall_handler()?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 10, 2017 11:17 AM   in response to: Andrew Bond in response to: Andrew Bond
Andrew Bond wrote:

My C++ app is crashing with a call to a pure virtual function.

Then you have a bug in your code that you need to fix. For instance,
this can happen if you call a pure virtual function in a base class
constructor/destructor and expect it to call an override in a derived
class. That does not work in C++ (it does in Delphi, though).

I would like to install my own handler for the call, which I know is
possible with MSVC using:

_set_purecall_handler()

But I can't find this in the <stdlib> supplied with C++Builder (I've
looked at the code that comes with Berlin).

AFAIK, there is no such hook in BCB.

--
Remy Lebeau (TeamB)
Andrew Bond

Posts: 183
Registered: 3/8/00
Re: Does BCB support _set_purecall_handler()?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 11, 2017 1:58 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Then you have a bug in your code that you need to fix. For instance,
this can happen if you call a pure virtual function in a base class
constructor/destructor and expect it to call an override in a derived
class. That does not work in C++ (it does in Delphi, though).

I know I have a bug! And I know the types of things that cause it. However, in a very large project, tracking down what is causing the pure virtual function call is very difficult. That is where _set_purecall_handler() comes in ... if C++Builder supported it (as MSVC does).

AFAIK, there is no such hook in BCB.

Thanks for confirming my fear.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02