- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hai
I wrote a vc++ program that calls imsl fortran subroutine NNLPF.The vc++ compiler is unable to read the header file link_f90_dll.h because it is written in fortran.Without this header file ,the program compiles without any errors.But there are unresolved external errors during build.
error LNK2019: unresolved external symbol _NNLPF@28 referenced in function _main
fatal error LNK1120: 1 unresolved externals
Is there any way of resolving this problem.Please help me in this regard.
swaroop
I wrote a vc++ program that calls imsl fortran subroutine NNLPF.The vc++ compiler is unable to read the header file link_f90_dll.h because it is written in fortran.Without this header file ,the program compiles without any errors.But there are unresolved external errors during build.
error LNK2019: unresolved external symbol _NNLPF@28 referenced in function _main
fatal error LNK1120: 1 unresolved externals
Is there any way of resolving this problem.Please help me in this regard.
swaroop
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First, please note that we don't explicitly support calling the IMSL routines from languages other than Fortran. Many times you can do it, but you have to be aware of the calling conventions and may have to carefully read both the IMSL documentation and the source of the Fortran interface (Provided in the IMSL include folder) to understand what is required.
The .h file you mentioned is there only to specify the names of the libraries to use. You can add the IMSL libraries you need to the project directly. You will also need the Intel Fortran libraries (libifcore.lib, ifconsol.lib, libm.lib, etc.)
It would seem that your C++ code has used __stdcall or similar to specify the calling convention of NNLPF. This is incorrect, as the IMSL as provided with Intel Fortran Professional uses the Intel convention of C.
You have the additional problem here in that NNLPF is provided only in a form designed to be called from Fortran 90/95 code, with some of its arguments being assumed-shape arrays. These require that you pass an Intel Fortran array descriptor, whose structure is documented in the Intel Visual Fortran Building Applications manual. The details of what to do here is beyond the scope of what I can help with.
My advice is to write a Fortran routine to serve as a jacket for NNLPF and call that from your C++ code.
The .h file you mentioned is there only to specify the names of the libraries to use. You can add the IMSL libraries you need to the project directly. You will also need the Intel Fortran libraries (libifcore.lib, ifconsol.lib, libm.lib, etc.)
It would seem that your C++ code has used __stdcall or similar to specify the calling convention of NNLPF. This is incorrect, as the IMSL as provided with Intel Fortran Professional uses the Intel convention of C.
You have the additional problem here in that NNLPF is provided only in a form designed to be called from Fortran 90/95 code, with some of its arguments being assumed-shape arrays. These require that you pass an Intel Fortran array descriptor, whose structure is documented in the Intel Visual Fortran Building Applications manual. The details of what to do here is beyond the scope of what I can help with.
My advice is to write a Fortran routine to serve as a jacket for NNLPF and call that from your C++ code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Alternatively, you can use the attached C++ template class, which emulates Visual Fortran allocatable/assumed-shape/pointer arrays. In effect, you can "write Fortran in C++". However, it currently works only for 1-d arrays.
Jugoslav
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page