# FAST S-Func MEXing process

**URL:** <https://forums.nlr.gov/t/fast-s-func-mexing-process/143>\
**Category:** Computer-Aided Engineering Software Tools\
**Created:** [July 16, 2008, 3:54pm UTC](https://forums.nlr.gov/t/fast-s-func-mexing-process/143 "2008-07-16T15:54:04Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![Yunchuan.Li](https://avatars.discourse-cdn.com/v4/letter/y/ea666f/32.png) [@Yunchuan.Li](https://forums.nlr.gov/u/Yunchuan.Li)\
**Post date:** [July 14, 2014, 10:10pm UTC](https://forums.nlr.gov/t/fast-s-func-mexing-process/143/21 "2014-07-14T22:10:24Z")

</div>

Hi Bonnie,  
Thank you for your reply.  
1.  
The first errors are like this

[code]–\> ifort /fpp /Qprec /assume:byterecl /traceback /real\_size:64 /Qzero /Qsave “/IE:\Program Files\MATLAB\R2013a/extern/include” -c -nologo -DMATLAB\_MEX\_FILE /fp:source /MD /FoC:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\FASTGateway64.obj /O2 /DNDEBUG -DMX\_COMPAT\_32 “E:\Control of Wind Turbines\FAST\_SFunc Compiling\FAST\Simulink\Source\FASTGateway64.f90”

```
Contents of C:\Users\CEL\AppData\Local\Temp\mex_gtzs6q\mex_tmp.rsp: 

```

C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\DoubPrec.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\SysMatlab.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\NWTC\_IO.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\NWTC\_Num.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\NWTC\_Aero.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\ModMesh.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\NWTC\_Library.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\SharedInflowDefs.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\HHWind.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\FFWind.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\HAWCWind.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\FDWind.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\CTWind.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\UserWind.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\InflowWindMod.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\SharedTypes.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\AeroMods.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\GenSubs.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\AeroSubs.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\AeroDyn.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\FAST\_Mods.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\Noise.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\fftpack.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\FFTMod.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\HydroCalc.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\AeroCalc.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\FAST\_IO.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\FAST.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\PitchCntrl\_ACH.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\SetVersion.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\UserSubs.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\UserVSCont\_KP.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\FASTSimulink.obj C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\FASTGateway64.obj

→ link /out:“FAST\_SFunc.mexw64” /dll /export:MEXFUNCTION /LIBPATH:“E:\Program Files\MATLAB\R2013a\extern\lib\win64\microsoft” libmx.lib libmex.lib libmat.lib /implib:“C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\templib.x” /MAP:“FAST\_SFunc.mexw64.map” /NOLOGO /manifest /INCREMENTAL:NO @C:\USERS\CEL\APPDATA\LOCAL\TEMP\MEX\_GT~1\MEX\_TMP.RSP

Creating library C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\templib.x and object C:\Users\CEL\AppData\Local\Temp\mex\_gtzs6q\templib.exp  
MSVCRT.lib(crtdll.obj) : error LNK2019: unresolved external symbol \_\_imp\_EncodePointer referenced in function pre\_c\_init  
MSVCRT.lib(atonexit.obj) : error LNK2001: unresolved external symbol \_\_imp\_EncodePointer  
MSVCRT.lib(crtdll.obj) : error LNK2019: unresolved external symbol \_\_imp\_DecodePointer referenced in function \_CRT\_INIT  
MSVCRT.lib(atonexit.obj) : error LNK2001: unresolved external symbol \_\_imp\_DecodePointer  
MSVCRT.lib(gs\_support.obj) : error LNK2019: unresolved external symbol \_\_imp\_QueryPerformanceCounter referenced in function \_\_security\_init\_cookie  
MSVCRT.lib(gs\_support.obj) : error LNK2019: unresolved external symbol \_\_imp\_GetCurrentProcessId referenced in function \_\_security\_init\_cookie  
MSVCRT.lib(gs\_support.obj) : error LNK2019: unresolved external symbol \_\_imp\_GetCurrentThreadId referenced in function \_\_security\_init\_cookie  
MSVCRT.lib(gs\_support.obj) : error LNK2019: unresolved external symbol \_\_imp\_GetSystemTimeAsFileTime referenced in function \_\_security\_init\_cookie  
MSVCRT.lib(dllmain.obj) : error LNK2019: unresolved external symbol \_\_imp\_DisableThreadLibraryCalls referenced in function DllMain  
FAST\_SFunc.mexw64 : fatal error LNK1120: 7 unresolved externals

E:\PROGRA~1\MATLAB\R2013A\BIN\MEX.PL: Error: Link of ‘FAST\_SFunc.mexw64’ failed.

Error using mex (line 206)  
Unable to complete successfully.

Error in make\_FAST\_SFunc (line 69)  
mex(‘-v’  
, … %verbose  
[/code]  
(I did NOT remove the “/MD” in COMFLAGS)  
If I remove this flag, the error would be

[code]LIBCMT.lib(wgetcwd.obj) : error LNK2001: unresolved external symbol \_\_imp\_GetFullPathNameW  
LIBCMT.lib(read.obj) : error LNK2019: unresolved external symbol \_\_imp\_ReadConsoleW referenced in function \_read\_nolock  
libirc.lib(tbk\_backtrace.obj) : error LNK2019: unresolved external symbol \_\_imp\_VirtualQuery referenced in function tbk\_getModuleName  
FAST\_SFunc.mexw64 : fatal error LNK1120: 137 unresolved externals

E:\PROGRA~1\MATLAB\R2013A\BIN\MEX.PL: Error: Link of ‘FAST\_SFunc.mexw64’ failed.  
[/code]

(There are hundreds of errors, I just pasted a part of them)

1. I checked the LIB, INCLUDE and PATH from the Intel 64 Visual Studio command prompt window. Originally they are different from those in the batch file. So I changed them and set the identical with those in the batch file, however, it did not help. Actually it shows the same error as I previously described.

And sorry for the ambiguous “linker direction”, I just mean “LINKERDIR”.  
Is there anything else I can check for the compiling process?  
Thank you!

Yunchuan Li

---

<div class="post-metadata">

**Author:** ![Michael.Shafer](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Michael.Shafer](https://forums.nlr.gov/u/Michael.Shafer)\
**Post date:** [July 28, 2014, 7:44pm UTC](https://forums.nlr.gov/t/fast-s-func-mexing-process/143/22 "2014-07-28T19:44:30Z")

</div>

Bonnie,  
I am a new FAST user and I am trying to get it up and running within Simulink. I have a 64-bit Windows machine and I have been attempting to use the 64-bit SFunc you posted in this post from last year:

> [@](#):
>
> Borchersen,
> 
> Thanks for posting your solution to getting the SFunc to work on 64-bit linux. I glanced at it briefly and made a quick fix to FASTGateway.f90 so that it should work on both 32 and 64-bit Windows.
> 
> To anyone else reading this,
> 
> You can download FAST\_SFunc for 64-bit Windows (FAST v7.02.00d-bjj) here. I’ve also placed some new source files there so people can compile it themselves. Note that you will need to add /fpp to the compile options (for preprocessing FASTGateway.f90).

I downloaded FAST\_SFunc.mexw64, saved it to the location where the old 32-bit version was located (I moved that original file elsewhere), and added the location of this new 64-bit file to MATLAB’s path. When I attempt to run the sample simulink model provided with FASTv7, OpenLoop.mdl, MATLAB consistently crashes. Do you have any idea why this might be happening?

FYI, prior to finding your FAST\_SFunc.mexw64 file, I had installed a 32-bit version of MATLAB and had similar results (crashing). I thought it might have had something to do with the fact that I was running on a 64-bit machine, which is why I did some more searching and found your post. Please help if you can. Thanks.

-Michael

---

<div class="post-metadata">

**Author:** ![Michael.Shafer](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Michael.Shafer](https://forums.nlr.gov/u/Michael.Shafer)\
**Post date:** [July 28, 2014, 9:29pm UTC](https://forums.nlr.gov/t/fast-s-func-mexing-process/143/23 "2014-07-28T21:29:29Z")

</div>

This is a reply to my own post from July 28, 2014.

I was able to get the Simulation to run. I have both the 32-bit and 64-bit versions of Matlab on my machine. It seems as though the 32-bit version was opening despite me selecting (what I thought was) the 64-bit version. When I finally realized what the problem was and opened the correct version, the simulation seemed to move pass point where it was previously crashing, but then would throw an error about needed to run Read\_FAST\_Input.m prior to starting the simulation. This isn’t mentioned in the FAST User’s Guide. When I ran that m-function and then ran the simulation, it seemed to run without issue.

-Michael

[Previous page](https://forums.nlr.gov/t/fast-s-func-mexing-process/143.md?page=1)
