Callbacks from C++ back to C#
问题 say I have a C++ library function for computing PI: // pi.h: #ifdef BUILDING_DLL #define DLL_MACRO __declspec(dllexport) #else #define DLL_MACRO __declspec(dllimport) #endif namespace Cpp { class PI { public: static double DLL_MACRO compute(); }; }; // pi.cpp: #include "pi.h" #include <cmath> double Cpp::PI::compute() { // Leibnitz summation formulae: double sum = 0.0; for(long n = 0; n < 100*1000*1000; n++) sum += 4.0*pow(-1.0, n)/(2*n + 1.0); return sum; } I need to call this function from