I am creating a new issue here because there are too many topics going on in issue #548:
From @eletroinf:
I Have the same problem with openFAST 2.4.0-master and dev.
Compilation with Visual studio and mex generated by C compiler installed by means of Matlab Add-on (Matlab 2018b).
The S-function generated using v 2.4.0 source files works fine with openFAST 2.3.0 that I also compiled with Visual Studio. So I think the problem is not with the S-function.
Neither my project nor the examples works - all them result in Matlab crash.
Originally posted by @eletroinf in #548 (comment)