Static or Dynamic Library for S-function

8 次查看(过去 30 天)
Hi,
I am trying to create an S-function to link OpenFAST with Simulink.
I succefully compiled the build libraries using CMake (on Mac OS).
However as I compiled the main .m file to create the Sfunction is face this error:
I read here https://github.com/OpenFAST/openfast/issues/208 that the issue can be due to the use of static (.a) libraries instead of synamic (.dylib).
My question is that can I create the Sfunction with static librairies, if so, how can I fix the issue?
Thanks in Advance
Qusay.

回答(1 个)

Pratyush
Pratyush 2024-5-17
Hi Qusay,
To create an S-function in MATLAB/Simulink that links with OpenFAST using static libraries (.a) on macOS, follow these steps:
  • Ensure static libraries are compiled for the correct target architecture and version of macOS, specifying architecture flags if necessary.
  • Write your S-function using the appropriate MATLAB API, typically the MEX-function API for C/C++ code.
  • Include static libraries and necessary directories in your "mex" compilation command, specifying include paths, library paths, and the library names.
  • Manually link all dependent static libraries in the correct order since static libraries don't automatically include their dependencies.
  • For complex configurations, consider customizing the "mex" build settings through "mexopts.sh" or "mexopts.bat" files to adjust compiler and linker settings.
  • Ensure correct paths, compatible architectures between libraries and the S-function.

类别

Help CenterFile Exchange 中查找有关 Embedded Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by