How create DLL using only C/C++ types?

1 view (last 30 days)
Alexander
Alexander on 16 Sep 2015
Library Compiler Application create DLL with MatLab type mwArray (for C++, and mxArray for C):
extern LIB_libcfit_CPP_API void MW_CALL_CONV cfit2(int nargout, mwArray& u, const mwArray& x);
My trading robot (MQL4/5 language of www.metaquates.net) can't use functions from DLL with such types. So I create function for robot (working in Metatrader 4):
__declspec(dllexport) int __cdecl Cfit(double* px, int N)
{
mwArray mwx(N, 1, mxDOUBLE_CLASS);
mwx.SetData(px, N);
mwArray u;
cfit2(1, u, mwx);
double result[1];
u.GetData(result, 1);
return static_cast<int>(result[0]);
}
Could you show a simple example (steps) how to create (using MatLab and/or Visual Studio) DLL for Metatrader?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!