Compiling options for DISCON.dll

Provide feedback, request enhancements, and get help with wind-turbine computer-aided engineering tools.

Moderators: Bonnie.Jonkman, Jason.Jonkman

Luiz.daRocha
Posts: 10
Joined: Sun Aug 08, 2010 7:53 pm
Organization: self
Location: Germany

Compiling options for DISCON.dll

Postby Luiz.daRocha » Wed Oct 06, 2010 1:09 am

Hello everybody,

I am currently trying to compile a DISCON.dll file for my wind turbine model. I had some problems with my file, so I first tried compiling the DISCON.f90 file that is delivered with the NREL 5MW model. The compilation works without errors, but the resulting DLL file is only 9KB instead of the 24KB of the original DLL, and a FAST simulation fails with a popup message:

Code: Select all

 "This application has failed to start because MSVCR80.dll was not found"
and a FAST error message

Code: Select all

"The DLL DISCON.dll could nod be loaded.".

I found several copies of this MSVCR80.dll on my computer from different programs, so I took one, and copied it to my work directory. Now I got a popup error:

Code: Select all

"Runtime Error! Program: [path to my working folder] R6034 An application has made an attempt to load the C runtime library incorreclty. Please contact [...]"

I use Intel Visual Fortran 11.1 and I tried these command lines for compiling:

Code: Select all

ifort /dll DISCON.f90
ifort /c /automatic /O1 /architecture:pn4 /Ob2 /MD /Gm /real_size:32 /assume:byterecl  /Qdiag-disable:5268 /dll DISCON.f90

I always get the same result. Could you tell me, how you compile your DISOCN.dll files?

Thank you,
Luiz da Rocha

Wei.Ni
Posts: 9
Joined: Fri Oct 01, 2010 8:14 am
Organization: RLE International GmbH, Germany
Location: Cologne, Germany

Re: Compiling options for DISCON.dll

Postby Wei.Ni » Wed Oct 06, 2010 6:19 am

Hello, I have met similar problem as you. I has Intel fortran compiler 9.1 with Microsoft VC++ 2008 express. I guess when we compile dll (dynamic-link-library), it just refers to serveral standard libraries and functions in the system but not save the functions in the DLL itself. My IT friend suggest me to compile with options:
ifort/dll /winapp /libs:static DISCON.f90

So that the necessary functions will be stored in the dll, it turns to be static-link-library. This method works for me, and at last, the generated dll file is over 370Kb.

I wish you good luck!

By the way, if you can find an old Compaq visual fotran compiler, it works with simple option df/dll DISCON.f90, and it generates 24Kb DISCON.dll

Luiz.daRocha
Posts: 10
Joined: Sun Aug 08, 2010 7:53 pm
Organization: self
Location: Germany

Re: Compiling options for DISCON.dll

Postby Luiz.daRocha » Wed Oct 06, 2010 8:49 pm

Thanks for your reply!

I tried that, but it still does not work. At first some more information on my build environment. I tried two PCs. Nr. 1 uses Win XP SP3 32bit with Visual Studio 2005 and the Intel Fortran 11.1 compiler. The second one is A Windows 7 64 bit with Visual Studio 2008 and the Intel Fortran 11.1 compiler. On both machines, I am able to compile A2AD and FAST without problems.

Now back to my problem with the DISCON.dll. I tried to compile it with

Code: Select all

ifort /dll /winapp /libs:static DISCON.f90
and got the result

Code: Select all

ifort: warning #10153: option '/Qvc8' or higher used with '/ML[d]' is not supported
[...]
LINK : fatal error LNK1104: cannot open file 'LIBC.lib'

The first is a warning, not too important i guess, even though i specified none of these options. the second is fatal and causes termination.

I did some research and found that this seems to be a common problem with VS2005 (and higher?), and a solution would be to tell the fortran compiler that it does not require the LIBC.dll:

Code: Select all

ifort /dll /libs:static /winapp DISCON.f90 /link /NODEFAULTLIB:libc


If I try this however, I get loads of errors:

Code: Select all

[...]
libifcore.lib(cvtas_a_to_s.obj) : error LNK2001: unresolved external symbol __fltused
libifcore.lib(cvtas_nan_t.obj) : error LNK2001: unresolved external symbol __fltused
DISCON.obj : error LNK2001: unresolved external symbol __fltused
libifcore.lib(cvt_cvtas_t.obj) : error LNK2001: unresolved external symbol __fltused
libifcore.lib(cvt_cvtas_s.obj) : error LNK2001: unresolved external symbol __fltused
libifcore.lib(cvtas_t_to_a.obj) : error LNK2001: unresolved external symbol __fltused
LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
libifcore.lib(for_f90str.obj) : error LNK2019: unresolved external symbol _memmove ref
[...]
LINK : error LNK2001: unresolved external symbol __load_config_used
DISCON.dll : fatal error LNK1120: 118 unresolved externals
so I guess, that this library is indeed required.

I got these results on both machines, with the 64bit machine set to 32bit build environment variables. With 64bit settings on the Win7 machine, I get another error (ifort: error #10037: could not find 'link') but that is not of interest for me, because I want a 32bit dll file.

By the way, if you can find an old Compaq visual fotran compiler, it works with simple option df/dll DISCON.f90, and it generates 24Kb DISCON.dll

I will see If I can find it, thanks!

Could anyone of you, who successfully compiled the NREL 5MW onshore DISCON.f90 tell me about their system specification, and build command?

Thanks a lot,

Luiz da Rocha

Luiz.daRocha
Posts: 10
Joined: Sun Aug 08, 2010 7:53 pm
Organization: self
Location: Germany

Re: Compiling options for DISCON.dll

Postby Luiz.daRocha » Wed Oct 06, 2010 9:39 pm

By the way, if you can find an old Compaq visual fotran compiler, it works with simple option df/dll DISCON.f90, and it generates 24Kb DISCON.dll


I found Compaq Fortran 6.6 lying around and it really works with that, thanks a lot! For me the topic is resolved now, for others it might sill be interesting to see some successful build options and system specs.

Thanks a lot!

Luiz da Rocha

Wei.Ni
Posts: 9
Joined: Fri Oct 01, 2010 8:14 am
Organization: RLE International GmbH, Germany
Location: Cologne, Germany

Re: Compiling options for DISCON.dll

Postby Wei.Ni » Thu Oct 07, 2010 12:34 am

Good morning, dear Luiz da Rocha

I am the person who compiled FAST, A2AD and DISCON.f90. It looks strange for your question, I doubt about the system enviornment settings for your intel fotran compiler, here is my PATH variable value:
Path=C:\Programme\Intel\Compiler\Fortran\9.1\Ia32\Bin;C:\Programme\Gemeinsame Dateien\Intel\Shared Files\Ia32\Bin;C:\Programme\Microsoft Platform SDK for Windows Server 2003 R2\Bin;C:\Programme\Microsoft Platform SDK for Windows Server 2003 R2\Bin\WinNT;C:\Programme\Microsoft Visual Studio 8\Common7\IDE;C:\Programme\Microsoft Visual Studio 8\VC\BIN;C:\Programme\Microsoft Visual Studio 8\Common7\Tools;C:\Programme\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Programme\Microsoft Visual Studio 8\VC\VCPackages;C:\PROGRA~1\MKSTOO~1\bin;C:\PROGRA~1\MKSTOO~1\bin\X11;C:\PROGRA~1\MKSTOO~1\mksnt;C:\Programme\Intel\MKL\9.1.027\ia32\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\Intel\Compiler\Fortran\9.1\IA32\Bin;C:\Programme\Intel\Compiler\Fortran\9.1\EM64T\Bin;C:\Programme\Intel\IDB\9.1\IA32\Script;C:\Programme\Microsoft Visual Studio 8\Common7\IDE;

LIBC.lib is in C:\Programme\Intel\Compiler\Fortran\9.1\IA32\Lib. If setting up the enviornment variable does not work, why not copy this file to your current directory?

here I post a screen shot of my compiling window. The compiler complains but works.
Image

Luiz.daRocha
Posts: 10
Joined: Sun Aug 08, 2010 7:53 pm
Organization: self
Location: Germany

Re: Compiling options for DISCON.dll

Postby Luiz.daRocha » Thu Oct 07, 2010 12:53 am

Hi again!

Thank you for pointing me to the correct direction! The problem was really caused by some incorrect environment variables. By calling

Code: Select all

C:\Program Files\Intel\Compiler\11.1\048\bin\ia32\ifortvars_ia32.bat
or
C:\Program Files\Intel\Compiler\Fortran\9.1\IA32\Bin\ifortvars.bat
before the compile command, I can now use the IVF 9.1 (size of DISCON.dll: 372 KB) as well as the IVF 11.1 (size of DISCON.dll: 424 KB) compilers to successfully compile it (with /libs:static). With the DF 6.6 compiler, it works without any additions.

Thanks and best regards,

Luiz da Rocha

Ville.Lehtomaki
Posts: 3
Joined: Tue May 25, 2010 5:57 am

Re: Compiling options for DISCON.dll

Postby Ville.Lehtomaki » Wed Oct 19, 2011 11:00 pm

Hi all!

I have come accross similar "challenges" while compiling the discon.f90 to discon.dll. On my computer (WinXp32bit) I have installed MVS (Microsoft Visual Studio 2008) and IVF( Intel Visual Fortran) 11.1.054. Running FAST with the recompiled discon.dll works with many different compiler options so I personally don't have any problems with the controller.

BUT funny things start happening (or actually nothing happens) when copying the entire simulation folder (contain all FAST model files, FAST.exe and discon.dll) to a new computer WITHOUT IVF preinstalled. This triggers the popular error message "DISCON.DLL could not be loaded". This is a systematic pattern, I tested it with 10 collegue computers (XP32 and Win7_64-bit all with no IVF preinstalled). It seems that when IVF compiles the discon.f90 (using default compiler settings) it needs some library files from the IVF installation folder when a FAST simulation is started. And if they are missing, discon.dll cannot be loaded.

So changing the compiler settings solved the problem :D If you are using MVS2008: Tools -> Options -> Intel(R) Visual Fortran -> Compilers -> Default options: /Qvc9 /Qlocation,link,"$(VCInstallDir)bin" /libs:dll OR /Qvc9 /Qlocation,link,"$(VCInstallDir)bin" /libs:static (underlining the added options). With these IVF settings, the recompiled discon.dll worked on my collegues computer that did not have IVF installed. These additional settings increased the discon.dll size to over 1000 kb, indicating it has "integrated" something into it :D

Hope this helps!

Alec.Mackendrick
Posts: 40
Joined: Thu Jun 28, 2012 10:37 am
Organization: Lloyd's Register
Location: UK

Re: Compiling options for DISCON.dll

Postby Alec.Mackendrick » Mon Jan 27, 2014 5:14 am

Just because I'm slow and don't use MVS very often, here are the instructions for MVS 2010. (For some reason it took me ages to figure out. DOH!)

Click on the DISCON.f90 in the solution explorer, then Tools > Options > Intel Composer XE > Visual Fortran > Compilers > Default options.

My settings were:
/Qvc10 /Qlocation,link,"$(VCInstallDir)\bin"
Updated to:
/Qvc10 /Qlocation,link,"$(VCInstallDir)\bin" /libs:static

and the DISCON.dll went from 23kb to 852kb.
Alec MacKendrick
Senior Control Specialist, EMEA
Lloyd's Register Group Limited

Bonnie.Jonkman
Posts: 561
Joined: Thu Nov 10, 2005 10:51 am
Organization: Envision Energy USA
Location: Colorado
Location: Boulder, CO
Contact:

Re: Compiling options for DISCON.dll

Postby Bonnie.Jonkman » Thu Feb 06, 2014 2:57 pm

Thanks, Alec.

I wanted to point out a couple of things:
  • The FAST archive contains a batch script that will compile DISCON.f90. Look for Compiling/Compile_DISCON_DLL.bat. You can change the CompOpts variable so that it contains /libs:static instead of /libs:dll. This script works a lot like the one described in the FAST compiling instructions.
  • You can change the configuration options (i.e., options specific to the Release or Debug configurations) instead of the default options, too. Just open your Project -> Properties window to Configuration Properties -> Fortran -> Libraries. The options "Multithreaded DLL" and "Debug Multithreaded DLL" are /libs:dll; the others are /libs:static.
    DLL_Options.png
    DLL_Options.png (51.01 KiB) Viewed 7251 times
Bonnie Jonkman

Envision Energy USA, 2016-
National Renewable Energy Laboratory, 2003-2016

Dimitrios.Bilionis
Posts: 3
Joined: Mon May 05, 2014 2:26 pm
Organization: National Technical University of Athens
Location: Greece

Re: Compiling options for DISCON.dll

Postby Dimitrios.Bilionis » Tue May 06, 2014 2:07 pm

Hi all,

My name is Dimitrios Bilionis and I am a PhD student at the National Technical University of Athens, Greece. I am analyzing offshore wind turbines for my dissertation using FAST v8 in a 64-bit machine with windows 7. I am actually focused on the 5 MW NREL wind turbine and using the sample files for this turbine that are contained in the FAST v8 archive.

I have though encounter some problems with the DISCON.dll, similar to those mentioned in previous posts by other users. My major problem is that FAST aborts when I am trying to incorporate the blade controls by using ServoDyn. Specifically, I get the following error:

"Message from SrvD_Init:
The dynamic library .\ServoData\DISCON_win32.dll could not be loaded. Check that the file exists in the specified location and that is compiled for 32-bit systems".

Since, I have double-checked that DISCON_win32.dll exists in the correct location, I assume that probably that .dll is not compatible with 64-bit systems. So, my question is: Is there any similar ".dll" for 64-bit systems available (e.g. DISCON_win64.dll)?

I am mainly asking for that, because I am not familiar with IVF or Microsoft Visual Studio (neither I have them installed in my PC), so it would be really difficult for me to compile the 32-bit .dll file. Furthermore, I am not going to use any custom controls but only those default controls that are associated with the DISCON.dll for the sample turbine.

Thank you in advance,
Dimitrios

Marshall.Buhl
Posts: 437
Joined: Fri Oct 21, 2005 10:22 am
Organization: NREL/NWTC
Location: Boulder, CO
Location: Boulder, CO
Contact:

Re: Compiling options for DISCON.dll

Postby Marshall.Buhl » Wed May 07, 2014 1:15 pm

Dear Dimitrios,

Thinking you need to run 64-bit software on a 64-bit computer is a very common misconception. All 64-bit, x86-based computers can run 32-bit software. If you look at the folders on drive C:, you will see "Program Files" and "Program Files (x86)". The first holds 64-bit programs and the latter holds 32-bit programs.

The only reason for compiling a program for 64 bits is if you are going to be using very large arrays. I have needed to do that for hour-long, high resolution wind files, but that is not common. If you are using the distributed, 32-bit version of FAST8, you need to use the 32-bit DLL on your 64-bit system. I don't believe Bonnie distributes 64-bit versions of FAST8, so FAST and DISCON.dll should be compatible.

It appears that FAST cannot find DISCON_win32.dll, so my guess is that your statement that it "exists in the correct location" is not actually true. I have found that putting it in the current working directory that is active when you run FAST is the correct location.


Marshall
Mr. Marshall L. Buhl Jr.
NWTC-3811
National Renewable Energy Laboratory
Golden, CO 80401 USA
Marshall.Buhl@nrel.gov
Voice: +1 (303) 384-6914
Cell: +1 (303) 915-6623
Fax: +1 (303) 384-7079

Bonnie.Jonkman
Posts: 561
Joined: Thu Nov 10, 2005 10:51 am
Organization: Envision Energy USA
Location: Colorado
Location: Boulder, CO
Contact:

Re: Compiling options for DISCON.dll

Postby Bonnie.Jonkman » Wed May 07, 2014 1:17 pm

Hi, Dimitrios.

Unless you've recompiled it using at 64-bit compiler, FAST v8 is a 32-bit application. A 32-bit application will look for 32-bit DLLs, even if it is running on a 64-bit system.

I don't think this is the problem (at least not yet, because you would get a different error later in the simulation), but the FAST v8.3 archive on the web contains DLLs that expect you to have the Intel libraries on the computer you are using. You can download DLLs without those dependencies here: http://wind.nrel.gov/public/bjonkman/De ... SCON_dlls/
I use these DLLs on my own 64-bit Windows 7 machine all the time, with no problem.

You might try to use the new DLLs and see if that helps fix the problem (maybe the DLL you are using got corrupted?). Otherwise, triple check that you've got the path to the DLL specified correctly. Then if you're still having trouble, perhaps you could post a screen shot of exactly what you typed to run the program and what the error says.
Bonnie Jonkman

Envision Energy USA, 2016-
National Renewable Energy Laboratory, 2003-2016

Dimitrios.Bilionis
Posts: 3
Joined: Mon May 05, 2014 2:26 pm
Organization: National Technical University of Athens
Location: Greece

Re: Compiling options for DISCON.dll

Postby Dimitrios.Bilionis » Sat May 10, 2014 5:07 am

Marshall and Bonnie,

First of all thank you for your responses.
Following your comments I downloaded the DISCON_win32.dll from the link that Bonnie posted and I have no problem with running ServoDyn now. So, my problem is fixed, at least for now.

Once again, I appreciate your immediate help.

Dimitrios

Jason.Lai
Posts: 50
Joined: Mon Dec 23, 2013 12:21 am
Organization: self
Location: Taiwan

Re: Compiling options for DISCON.dll

Postby Jason.Lai » Thu Dec 04, 2014 5:45 am

Dear sir
I have a question about compile DISCON.dll why I leave other file such as DISCON.lib,DISCON.exp?
I think I don't compile my DISCON.dll completely whether I forget to rewrite some code?
Thanks for your help.

Jason. Lai

Code: Select all

@ECHO OFF

REM ----------------------------------------------------------------------------
REM                   set compiler internal variables
REM ----------------------------------------------------------------------------
REM    You can run this bat file from the IVF compiler's command prompt (and not
REM    do anything in this section). If you choose not to run from the IVF command
REM    prompt, you must call the compiler's script to set internal variables.
REM    TIP: Right click on the IVF Compiler's Command Prompt shortcut, click
REM    properties, and copy the target (without cmd.exe and/or its switches) here:

ECHO.
 
IF "%INCLUDE%"=="" (

IF /I "%1"=="64" ( ECHO //// Using intel64 compiler \\\\
CALL "C:\Program Files (x86)\Intel\Composer XE 2011 SP1\bin\ipsxe-comp-vars.bat" intel64 vs2010
) ELSE ( ECHO  //// Using ia32 compiler \\\\
CALL "C:\Program Files (x86)\Intel\Compiler\11.1\038\bin\ia32\ifortvars.bat" ia32 vs2008
)

) ELSE ( ECHO //// Using existing compiler settings \\\\
)

REM ----------------------------------------------------------------------------
REM                   set compiler and linker options
REM ----------------------------------------------------------------------------

REM Use /libs:static if the DLL will be used on other PCs. (will result in a
REM   larger dll)

rem SET CompOpts= /nologo /O2 /inline /traceback /libs:static /threads
SET CompOpts= /nologo /O2 /inline /traceback /libs:static /threads
rem SET LinkOpts=/link

SET FileName=DISCON

REM ----------------------------------------------------------------------------
REM                   compile DLL
REM ----------------------------------------------------------------------------

ECHO.
ECHO Creating %FileName%.dll:

CALL IFORT /dll %CompOpts% %FileName%.f90 /exe:%FileName%.dll

ECHO.

REM ----------------------------------------------------------------------------
REM                   clear variables
REM ----------------------------------------------------------------------------

DEL %FileName%.obj

SET CompOpts=
SET LinkOpts=
SET FileName=


Image

Bonnie.Jonkman
Posts: 561
Joined: Thu Nov 10, 2005 10:51 am
Organization: Envision Energy USA
Location: Colorado
Location: Boulder, CO
Contact:

Re: Compiling options for DISCON.dll

Postby Bonnie.Jonkman » Thu Dec 04, 2014 9:52 am

The .lib and .exp files have uses depending on what you are going to do with the DLL that was generated. But, for the Bladed-style controller used in FAST, we don't need them.

This is because we dynamically (explicitly) load the DLL. This allows us to state explicitly which DLL we want to use in a simulation--both it's name and location--and to use different controller DLLs without having to copy and rename them every time we want to run FAST.

This is in contrast to DLLs like MAP_Win32.dll. When we link the FAST v8 executable, we link it with the MAP_Win32.lib file; this tells us what subroutines we can access in MAP_Win32.dll. It also means that Windows must be able to find and load MAP_Win32.dll before FAST will run, even if you are not using MAP for that particular simulation.
Bonnie Jonkman

Envision Energy USA, 2016-
National Renewable Energy Laboratory, 2003-2016


Return to “Computer-Aided Engineering Software Tools”

Who is online

Users browsing this forum: No registered users and 1 guest