Why do I receive a calling convention error when calling a Fortran function from a C S-Function with Simulink?

조회 수: 1 (최근 30일)
I have a legacy Fortran function that I am using from Simulink via a S-Function wrapper. When I debug it using Visual Studio, MSVC gives me the following error about calling conventions.
Debug Error!
The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2009년 6월 27일
The error message indicates that there is a calling convention mismatch.
A workaround is to try placing a __stdcall or __fastcall statement (depending on the compiler) between the "extern type" and the function name in the function prototype in the c-file.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

태그

제품


릴리스

R2006a

Community Treasure Hunt

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

Start Hunting!

Translated by