- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Hello,
I am new using Fortran and Visual Studios. I am developing a C++ code that calls fortran functions and routines. My question is about what is better: to build fortran code as a static library or as dll? In my fortran code I will call IMSL Libraries.
When is best to use each alternative?
Thanks and best regards.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Either one is fine. Static library is simpler.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perfect Steve, thanks.
Another question: When I try to build my solution, I get this error:
fatal error LNK1104: cannot open file "..\flib\debug\lib.lib".
I look at additional dependencies properties and there is none. Which could be the problem?
Thanks and best regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does that file exist? For a mixed C++/Fortran project, you'd need to specify the build dependencies so that the library was built first. Right click on the C++ project and select Build Dependencies > Project Dependencies. Check the box for your flib project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve, I fixed the problem with your advice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Steve,
I understood how to link my fortran functions and subroutines with my c++ code. But how can I call MKL fortran functions, for example as DGEMM, from my c++ code? How must I declare it in my fortran code?
Thanks and best regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may use the C interfaces (Cblas, LapackE) or the Fortran77 interfaces. There are a number of header files to help with the function prototypes, and each routine has an MKL page with details on which header to include, and a description of the argument list.
The MKL examples directory contains many examples of calling MKL routines from C.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I found MKL examples and I understood how to call MKL routines from C. I have another problem. When I try to build my solution, in which my c programm call fortran routines/functions, I am having problems when I include "mkl_lapack.fi" I get several errors of these type:
C:\ (...)\mkl\include\mkl_lapack.fi error #5082: Sysntax error, hound END-OF-STATEMENT when expect one of: *<identifier>.
(many errors like this one)
FSUB.F90(81): catastrophic error: too many errors, existing.
I believe that I have a configuration problem. I am using Visual Studios 2008 with Intel Composer XE 2011.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The file mkl_lapack.fi contains interface blocks. Where was your INCLUDE statement positioned in the file FSUB.F90? Can you post the file FSUB.F90 as an attachment?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
In my FSUB.F90, a fortran library project, I have several functions and subroutines. I can´t post my file FSUB.F90 because I am using remote deskpot and I can´t download my code files. I wrote a part of my file FSUB.90:
Real*8 Function PRMPI(N,JPICK,AMU,TOL)
INCLUDE 'C:Program Files()x86)\Intel\ComposerXE-2011\mkl\include\mkl_lapack.fi'
USE POTRF
Implicit Real*8 (A-H,O-Z)
....
End
... (other functions and subroutines)
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The position of the USE statement is incorrect. It should occur before other declarations. Secondly, there is no module with the name POTRF -- in fact, there are hundreds of MKL routines in the library, but there are only a handful of modules that provide access to those routines. The MKL manual tells you which modules to use. However, if your code is calling the MKL routines with the F77 interface, USE statements for the relevant modules are optional.
In general, when you have faulty code and cannot post it, chances are low for diagnosing the error correctly.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page