Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

DLL Sample for Fortran for Windows

postaquestion
Novice
781 Views

I am trying to find and run a test program in the latest version of Intel's FORTRAN for Windows that I downloaded and installed on a test machine.

I am working within Visual Studio 5. All I want to do is show myself that I can write a FORTRAN dll and then call it from a FORTRAN console application.

Can someone help me with a simple sample?

0 Kudos
6 Replies
Steven_L_Intel1
Employee
781 Views

Do you mean Visual Studio 2005?

I have attached a sample solution. Note that there is a post-build step to copy the DLL to the console project's Debug or Release folder. You will also need to have updated PATH to include the folder containing the Fortran run-time DLLs.

0 Kudos
nlbcostello
Beginner
781 Views

Steve,

I am using Visual Studio 2005. I tried the sample. No luck yet, so one-step-at-a-time.

Please explain: "You will also need to have updated PATH to include the folder containing the Fortran run-time DLLs."

Thanks,

Norm

0 Kudos
Steven_L_Intel1
Employee
781 Views

When the compiler installs, you are asked if you want to update the system PATH, INCLUDE and LIB environment variables. The default is to not do so (Microsoft recommendation), but not updating PATH means that programs which depend on the Intel Fortran run-time DLLs won't run because these DLLs can't be found.

To fix this, right click on My Computer, select Properties, Advanced, Environment Variables. Edit the system PATH environment variable to add at the end:

C:Program FilesIntelCompilerFortran9.1IA32Bin

If you have the compiler installed somewhere else, change as needed. Entries ar separated by semiolons.

What doesn't work?

0 Kudos
nlbcostello
Beginner
781 Views

Thanks Steve,

This is what works.

Copy sample application to Visual Studio projects folder.

Open ConsolCallsDll solution; bulid Dll; rename Debug file in ConsoleCallsDll folder; Copy complete Debug folder from Dll folder and paste in ConsoleCallsDll folder; bulid solution.

Then it runs in dubug or without debug mode.

I am trying to make the same project with the help of Visual Studio by making a empty console project and an empty dll project; adding the source code from the sample to the console and dll. When I build the dll it is fine. When I build the Console app I get error LNK2019: unresolved external symbol _MYSQRT referenced in function _MAIN__; and fatal error LNK1120: 1 unresolved externals.

Thanks again,

Norm

0 Kudos
Steven_L_Intel1
Employee
781 Views
You have to make the DLL project a dependent of the console project. Right click on the Console project, select Dependencies. Check the box for the DLL project.
0 Kudos
nlbcostello
Beginner
781 Views

Thanks Steve,

I did just that in a new solution, bulit the dll, console app and copied the dll to the console app debug folder. Ran fine.

All is getting better. Look fowared to working with you on other..... fortran code.

Thanks again,

Norm

0 Kudos
Reply