Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling DLL from QM
#5
Macro Macro2345
Code:
Copy      Help
//Put this before a non-class function declaration and definition to export the function with __cdecl calling convention. It is the easiest way, don't need a .def file. Using Microsoft Visual C++.
#define EXPORTC extern "C" __declspec(dllexport)

namespace Math
{
,class MathFuncs
,{
,,public:
,,// Returns a + b
,,static double Add(double a, double b);
,};

,double MathFuncs::Add(double a, double b) { return a+b; }

EXPORTC
double Math_Add(double a, double b) { return MathFuncs::Add(a, b); }        
}

With COM interface more work. If don't need to export non-static class members, better use extern "C".


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)