While it is known to use templates for class arguments, I had the surprise to find that the following class definition in the `stdafx.h:
struct fints {
/*variables paramétriques de la série financière*/
string desc{ "" };
USHORT periode{ 1 };
fints(const auto& d, const matrice& A, const Representation& r = Representation::absolu) noexcept;
...
};``
with appropriate definition in stdafx.cpp
, was accepted in the MSVC 2022 C++ compiler, but generated an error with the MATLAB compiler for generating an mex file:
error LNK2019: symbole externe non r‚solu "public: __cdecl fints::fints<class vecteur>(class vecteur const &,class matrice const &,enum Representation const &)"
To solve the problem, I had to fall back to the traditional definition, replacing the auto
by an already defined class, eg:
fints(const auto& d, ...
into
fints(const vecteur& d,
I designed a meta compiler for MATLAB, transforming a series of functions written in C++ into mexFunctions that can be used in MATLAB. Arguments from MATLAB workspace are converted into C++ classes, and vice_versa.