main.cpp
public cpp v1 · immutable#include <iostream>#include <stdexcept>using std::cout;using std::endl;extern "C" void plain_c_function(void (*ptr)());void call2(){ throw std::runtime_error("Testing");}void call1(){ plain_c_function(&call2);}int main(int argc, char** argv){ cout << "Calling 1" << endl; try { call1(); cout << "Call 1 succeeded"; } catch(std::exception &e) { cout << "Exception thrown: " << e.what(); } return 0;}