Here is the exact error message on compilation:
error C3352: 'double MyNamespace::MyRefClass::MyFunction(const std::vector<_Ty> &,std::vector<_Ty> &,void *)' : the specified function does not match the delegate type 'double (const std::vector<_Ty> &,std::vector<_Ty> &,void *)'
MyFunction
is a private function in the reference class MyRefClass
The quoted error shows up when I try to create an instance of the private delegate MyDelegate
, declared in the same reference class, with the code:
MyDelegate^ del = gcnew MyDelegate(&MyRefClass::MyFunction);
As far as I can tell, the signatures of the function MyFunctionWrapper
matches the delegate, so I'm not sure what is causing the error.
For completeness, the (private) function signature is:
double MyFunction(const std::vector<double> &x, std::vector<double> &grad, void *data)
and the (private) delegate declaration is:
delegate double MyDelegate(const std::vector<double> &x, std::vector<double> &grad, void *data);