Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
3 Views

How to use F90 IMSL routine (e.g lin_sol_gen)in intel c++

Hi,
I've been using the IMSL Fortran library with the intel c++ compiler. I can successfully use the IMSL routines that have a F77 interface e.g UMPOL etc.
Here's how i did it in my example.cpp file
extern "C"
{
...
void UMPOL(*args,...);
}
main()
{
...
UMPOL(&args,... );
}
and i would compile in 2 steps:
(1) icl -c example.cpp
(2) ifort example.obj %link_f90%
However i have trouble to use those routines which only have a F90 interface (e.g LIN_SOL_GEN) in a similar way. For instance, if i substitute LIN_SOL_GEN for UMPOL in my example.cpp file above, i would be able to create the example.obj filefrom step (1) but step (2) would return a linking problem:
Anybody knows how to make this work?
Related to this, F90 IMSL routines like LIN_SOL_GEN have .mod files asscoiated to them? Anybody knows how to use these in c/c++. I know that in Fortran, wenormally enter
use lin_sol_gen_int
at the top of the .f90 file (just as weinclude a header file in c/c++). Anybody knows what needs to be done touse the .mod file in a .cpp file?
Last, the F90 interface allows for optional arguments? Anybody knows how to pass these arguments to c/c++, if necessary?
Gino
0 Kudos
3 Replies
Highlighted
3 Views

Re: How to use F90 IMSL routine (e.g lin_sol_gen)in intel c++

You can't use the C ... syntax with these routines. What you want to look at is the "F77" calling syntax as described in the manual. Ignore the F90 syntax with the optional arguments.

You can't use the module files. You will have to write your own C headers for the IMSL routines.
Retired 12/31/2016
0 Kudos
Highlighted
Beginner
3 Views

Re: How to use F90 IMSL routine (e.g lin_sol_gen)in intel c++

Thank you for your reply.
If i understand correctly routineslike LIN_SOl_GEN which, as per the manualonly have a F90 interface CANNOT be used in c. Can you please confirm whether this is correct.
If not, can you explain how it can be done?
Last, do you know if there is a trial version of IMSL C library on offer somewhere?
Thanks again,
Gino
0 Kudos
Highlighted
3 Views

Re: How to use F90 IMSL routine (e.g lin_sol_gen)in intel c++

If you want to use UMPOL, the "F77" interface is:

CALL UMPOL (FCN, N, XGUESS, S, FTOL, MAXFCN, X, FVALUE)

LIN_SOL_GEN is intended for use with defined operators in F90 and I don't see an obvious way to use it from C++. I'm sure it's possible, but the source code for the interface is not published so it would require some detailed examination of sample compiled code to see what to do.

VNI sells IMSL for C++ - as far as I know, trial versions are not available. Please contact Visual Numerics (www.vni.com) for more information.

Retired 12/31/2016
0 Kudos