code generation of MEX marshalling functions
8 views (last 30 days)
Show older comments
Hi, (my first one)
I have a MEX function made of C/C++/Fortran legacy code, and I want to mexCallMATLAB() from it a MATLAB function.
So I have to write (a lot of) marshalling code between C/C++ data structs and mxArray data.
There is a straight naming scheme between C/C++ struct fields and MATLAB struct()'s fields. E.g :
----- C/C++ types/datas :
struct rep { float x, y; };
struct sxx { struct rep rep; int n; } sxx;
struct syy { struct rep rep; int m; } syy;
...
mxArray *foo = <marshalling code to/from sxx and syy>
mexCallMATLAB(..., 'fn');
---- versus MATLAB datas :
sxx.rep.x = single(0);
sxx.rep.y = single(0);
sxx.n = int32(0);
syy.rep.x = single(0);
syy.rep.y = single(0);
syy.m = int32(0);
...
function fn (sxx, syy) ...
For some modules, the C/C++ types are made of codegen'd source code, because in some configuration the MATLAB function is codegen'ed to C/C++ and the MEX Function is a native executable.
Is it possible to codegen the marshalling code ? I would like it to use only mex.h API, not EMLRT.
0 Comments
Answers (0)
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!