Ian Luebeck
Ian Luebeck

Reputation: 13

Suppress Message Box R6025 Pure Virtual Function Call

I am developing a .NET 4 Application (WPF) that is using an old C++-Library. This library is buggy and at times I get pure virtual function calls. (And there is nothing I can do about that library...)

I have setup a Handler using _set_purecall_handler from msvcr100.dll. During debugging I can also confirm that my handler is called. After leaving my handler however, the applications shows the MessageBox informing of the pure virtual function call and then exits the application.

How can I prevent this messagebox from showing and continue to run the app?

Upvotes: 0

Views: 561

Answers (1)

Jonathan Potter
Jonathan Potter

Reputation: 37132

Since there's no way to recover safely from a call to a pure virtual function, a purecall handler is expected to terminate the process after reporting the error to the user. If your handler returns instead of terminating then it's assumed to have done nothing and the default handling kicks in.

Simply call exit(0) or similar at the end of your handler and the original dialog will be suppressed.

Upvotes: 0

Related Questions