FAST S-Func MEXing process

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

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:

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

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