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

Why has my *.dll become invisible?

sbenati
Beginner
733 Views
My mylib.dll becomes invisible to VBA if I put intrinsic function on the code, or if I use IMSL library functions.
Why this?
(I use Excel2000, CVF 6.6, Windows ME)

In VBA I wrote:

Declare Sub addone Lib "mylib.dll" _ Alias "_ADDONE@4" (ByRef a As Single)
Sub Addition()
Dim a As Single
a = 7
Call addone(a)
MsgBox a
End Sub

Then in fortran I wrote

Subroutine addone(a)
!DEC$ATTRIBUTES DLLEXPORT :: addone
real a
a = a + 1.0
end subroutine addone

Compile 0K! Build mylib.dll OK!
Call mylib.dll from VBA OK! A message-box with the number 8 appears!

Now I modify the subroutine inserting an intrinsic function:

Subroutine addone(a)
!DEC$ATTRIBUTES DLLEXPORT :: addone
real a, b
b = 1.0
a = a + sqrt(b)
end subroutine addone

Compile 0K! Build mylib.dll OK!
Call mylib.dll from VBA: the following message appears (in italian) Run-Time error 48 Cannot find file mylib.dll.

The file is there, visible from windows, from dos and so on! I moved it somewhere else: always unvisible! If I remove the function "sqrt", the file becomes visible again! What is going on?
(N.B. If I put "use imslf90" and "a = a + cbrt(b)", it happened the same: mylib.dll becomes unvisible!)
Thank you for all the suggestions!
0 Kudos
2 Replies
Steven_L_Intel1
Employee
733 Views
It may help you to know that this message can also mean that one of the DLLs your DLL uses can't be found.

Steve
0 Kudos
sbenati
Beginner
733 Views
Thank you for the suggestions. I am not a very strong programmer, but I report here how I solved my problem:

I made sure that the project setting were:

Project>Settings>Fortran>Run Time Libraries>Single-Threaded.

By this way I think that the *.dll does not require any other additional file.

Then the builder suggested me to add:

/nodefaultlibrary:mvcrtd.lib in

>Settings>Link>Project Options

Now the code works well and can be exported to other machines...at least today I haven't found a counterexample yet!
0 Kudos
Reply