Is it possible to stop the simulation on purpose from a c++ module

I am handling exceptions inside a c++ module. I am printing an error message to the console (include stdio.h and use printf). By the nature of my module, this exception could happen multiple times during simulation, but I would like to keep the console “tidy” by showing only the first occurrence.

One solution is to stop the simulation at the first exception occurrence:
Is there a global method that could be called from within the dll to accomplish that? If yes, how to make the call?

Hi @Egrana, you can include <stdlib.h> and use the command exit(3); (not 0 because even if it works, usually it is used to tell the operating system that there was no error) to stop the simulation.

1 Like