Passing parameters to a function from a library generated with Matlab Compiler SDK
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I buit a library using Matlab Compiler SDK (Matlab 2020b) and I am trying to call it from a program (64bits developped with Labwindows CVI 2017). I observed a behavior I cannot understand with function having more than one input argument. For example, I have a function with two input arguments that are vectors; when calling it, the content of the last argument is duplicated twice and then, the even indexes of the resulting c array are passed to the first argument, while the odd indexes of the C array are passed to the second argument.
Maybe a piece of Matlab code to explain what I mean may help:
% Assuming I have two vectors A & B as follow:
A = 1:3;
B = 4:6;
% I call my library (in C) with a call such as:
% mxArray *Ax = mxCreateDoubleMatrix( 3, 1, mxREAL );
% mxArray *Bx = mxCreateDoubleMatrix( 3, 1, mxREAL );
% And I fill Ax with A and Bx with B using memcpy
% mlfExtract( 2 , &Output1 , &Outpu2, Ax, Bx );
% Inside the mlfExtract function I have
NewVect = [B,B];
Ax = NewVect(1:2:end);
Bx = NewVect(2:2:end);
For now I am cheating by mergeing all my argument in a single matrix, but I would need to understand what is going on to get a proper fix. It maybe an issue of call convention that differs between Matlab (using the mvsc compiler) and Labwindows CVI, or it could be something else. This exceed by far my programming skills.
As an additional note, I also get a General Protection Fault with function with more than one input parameters.
If anyone has an idea, please let me know.
Best regards
Rémy Lassalle-Balier
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Troubleshooting in MATLAB Compiler SDK en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!