The library has functions for export. One of them is getMethod() . It returns a pointer to a class object ( CGradDescSol being an ISolver ) that has no fields. When you try to access the method of this class through "dereference" an error occurs. When you try to create a pointer to an interface ( ISolver ), and then assign getMethod() returns an access violation. Library is loading, function too.

Ad F:

 typedef ISolver* (_cdecl *PROCFUN)(void); ISolver *solve; solve = (*F)(); // ERR solve->getSolution(newpara,&f1); 

The function in the dll is:

  extern "C" __declspec(dllexport) ISolver* getMethod() {return new CGradDescSol;} 

ISolver interface:

 class ISolver { public: __declspec(dllexport) virtual void solve(MyFunction *f, Array<double> &x0) = 0; __declspec(dllexport) virtual void getSolution(Array<double> &x, MyFunction *f) = 0; }; 

CGradDescSol - the successor, consists only of the implementation of virtual methods.

  • solve = (*F)(); - pointer variable F as initialized? - ߊߚߤߘ

0