- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 filemylib.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!
Why this?
(I use Excel2000, CVF 6.6, Windows ME)
In VBA I wrote:
Declare Sub addone Lib "
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
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!
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
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!

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