The issue stems from the "S-function modules" entry in the S-function dialog box. File names should be entered here without the ".c" extension. you may try entering filename without any extension to resolve the issue.
You can also refer to the link below to understand more about S-function modules and their programmatic use.