In general, the %function directive is used to follow the S-Function API rather than to create user defined functions.
To call an externally defined C function you can add source and header files using SLibAddToStaticSources and LibAddToCommonIncludes. This will allow you to call a user defined function within the tlc. For example, to include the files use:
to call the function, use:
It is a good idea to start with the legacy code tool, which can generate an S-Function and TLC-file from a custom C-file, then if needed customize the TLC code of your S-Function.
Best Answer