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

IMSL subroutine in a fortran .dll

sbenati
Beginner
308 Views
I experienced very strange behaviours of "my.dll", for example when it is called from VBA (wrong computations, Excel crashes, and so on: see my mail of 19 august).

Now I wonder: Is it possible that this strange behaviour is due to the use of IMSL procedures inside my.dll?

That is: if "my.dll" uses only standard fortran statements, everything is OK: I can use my.dll from Excel-VBA, and the computation works correctly even in different PCs.

But Excel crashes when a IMSL procedure is required.

All the best to everybody, Stefano
0 Kudos
3 Replies
gfthomas8
Novice
308 Views
A CVF DLL that uses IMSL should be fine with one proviso: if IMSL wants to write to a console then the DLL had better provide one. VB or Excel/VBA as client of the DLL can't do that AFAIW. Have you tested your DLL using a CVF console application client? I don't use Excel/VBA much, but IIRC, it's hostile to single precision floats.

Anyhow, a CVF DLL using IMSL can be called without problems from VB.

HTH,
Gerry T.
0 Kudos
sbenati
Beginner
308 Views
I made a mistake in the VBA code:

Option Explicit
Dim i, j As Long

does not imply that "j" is actually long (maybe it is trated as Variant or something else)

I had to write

Dim i As Long
Dim j As Long

The mistake was not recognize by the VBA compiler,
and then the dll is called but the effects were catastrophic.

Now in my PC the code works correctly, tomorrow I will
check the portability.

Thanks to everybody for all suggestions, Stefano
0 Kudos
Intel_C_Intel
Employee
308 Views
You could write:

Dim i As Long, j As Long, x As Double, y As Single, ... etc.

If the type is not given after the variable name, then it is assumed as default, which in VB is Variant.

Sabalan.
0 Kudos
Reply