// External.cpp - useless C++ code calling pascal main. #include #include "MainExports.h" template struct Horror { void Message() { Message(Selector::yes>()); } private: template struct Selector {}; void Message(Selector) { ::Message("\pCalling pascal from template Horror [T=int]"); } void Message(Selector) { throw 1; } template struct IsInteger { enum { yes = std::numeric_limits::is_integer }; }; }; extern "C" { SInt32 CPlusFunction() { try // call pascal from C++ template instances { Horror().Message(); Horror().Message(); } catch (...) { Message("\pCalling pascal from a C++ catch"); } // C++ fun is over, go home to mother pascal :) return 456; } } // extern "C"