Legacy Code - Functions with arguments not working

Hey,
I try to build a S-Function with legacy_code, but I get a error while building with:
legacy_code('sfcn_cmex_generate', def);
the following Error:
Error using legacycode.LCT.legacyCodeImpl
Cannot find a valid argument list in the function specification:
--> void Init(int32)
Error in legacy_code (line 101)
[varargout{1:nargout}] = legacycode.LCT.legacyCodeImpl(action, varargin{1:end});
Header-File:
#ifndef __Bridge__
#define __Bridge__
void Init(int fosc);
void Init(void);
#endif
Fcn-Spec:
void Init(int32 fosc)
If I test this with the other function with no arguments, all works correctly. What am I doing wrong?

2 commentaires

May I ask if you have solved this problem? I have also encountered the same problem
可华
可华 le 24 Avr 2024
Modifié(e) : 可华 le 24 Avr 2024
I met this isuue too. The reason is that the input parameters of function must be named to u1, u2 etc.
So, you must change "int32 fosc" to "u1" in every .c file.
Similar to output parameters, they must be named to y1.

Connectez-vous pour commenter.

Réponses (0)

Modifié(e) :

le 24 Avr 2024

Community Treasure Hunt

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

Start Hunting!

Translated by