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

Creating Fortran DLL's using DIVPAG (IMSL)

Hello,

I have a set of stiff equations which I don't want to solve in Excel. Instead I want to pass the N equations, Y(N) at t=0 through the help of a DLL into Fortran, solve them in Fortran using the DIVPAG ODE Solver (I have Intel® Parallel Studio XE Composer Edition for Fortran Windows* with Rogue Wave* IMSL* bought in Dec 2015) and then pass the results back to Excel at t=dt. I know N, Y(N), can calculate LHS for Y equations, i.e. all info to use DIVPAG. 

I have created Fortran DLL's before but this time the trouble I think is, how to set up the correct arguments for invoking IMSL and the DIVPAG routine. Is there guide that can tell us what arguments to invoke before using DIVPAG?

Below is what I have done:

1. Based on (https://software.intel.com/en-us/articles/installing-and-using-the-imsl-libraries) set up the correct libraries in MS Visual Studio: $(FNL_DIR)\IA32\lib and $(FNL_DIR)\IA32\include\dll  (for IA-32 architecture target). 

2. Added: USE IMSL_LIBRARIES to the top of my code

3. Added: USE IVPAG_INT

3. Added: include 'link_fnl_static.h'

4. Added: !DEC$ OBJCOMMENT LIB:'libiomp5md.lib'

When I compile I get a bunch of warning but more importantly 2 errors:

a. Error LNK2019: unresolved external symbol _divpag@56 referenced in function

b. Fatal error LNK1120: 1 unresolved externals    Debug\XYZ.dll    

 

 

Could anyone point me to the correct way of invoking and using DIVPAG and creating a DLL. 

Thanks. 

 

 

 

 

 

 

 

0 Kudos
4 Replies
Highlighted

You are probably compiling

You are probably compiling with non-default options for /iface, such as /iface:stdcall or /iface:stdref. This is not compatible with calls to IMSL.

I'd also recommend that you review the IMSL EULA, in particular, section 5.

Retired 12/31/2016
0 Kudos
Highlighted
Beginner

Yes Steve, you are correct I

Yes Steve, you are correct I am compiling using:

ifort /nologo /debug:full /Od /warn:interfaces /iface:stdcall /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc120.pdb" /traceback /check:bounds /check:stack /libs:static /threads /c /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Intel Fortran\Microsoft Files\VC\\bin"

This is a rookie question but could you tell how to lay-off compiling with 'stdcall' in MS Visual Studio? Currently I just go to my Solution Explorer on right and hit Build or Rebuild. 

 

0 Kudos
Highlighted

This is not a default option.

This is not a default option. In the project properties, go to Fortran > External Procedures. Set Calling Convention to Default. Name Case Interpretation should also be Default, String Length Argument Passing should be After All Arguments and Append Underscore should be No.

Retired 12/31/2016
0 Kudos
Highlighted
Black Belt

Please read the comments

Please read the comments (esp. #2) regarding IVPAG at http://forums.roguewave.com/showthread.php?1542-Ivpag .

0 Kudos