- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use DLL writed with DVF 6.0 and I search to inform the user in screen, when a problem is comming in the datas of the DLL, but the instructions WRITE, TYPE and PRINT occurs errors of execution.
I need help, please.
I need help, please.
Link Copied
17 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using your dll from VB? If so, there's no console to write to. Either create a console using the AllocConsole API, or pass the information back to VB for it to display.
hth,
John
hth,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Johan, would you please be more specific on how to use ALLOCONSOLE. I have the sililar problem too. I use VB to call a DLL written in DVF 5.0 D. I hate to pass info back to VB. Is there any way to dump error message from DLL?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Something like:
! ...
use dfwin
! ...
logical :: bret
! ...
bret = AllocConsole()
! ...
print *, "Blah, blah, blah"
! ...
bret = FreeConsole()
! ...
should do it. FYI, you can also freely write to a file from your dll. IMO, passing the info back to VB is the optimal solution.
hth,
John
! ...
use dfwin
! ...
logical :: bret
! ...
bret = AllocConsole()
! ...
print *, "Blah, blah, blah"
! ...
bret = FreeConsole()
! ...
should do it. FYI, you can also freely write to a file from your dll. IMO, passing the info back to VB is the optimal solution.
hth,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ughh. That last post was on separate lines when I wrote it. And it was on separate lines in the preview window. Double Ughh.
-John
-John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Would it be a solution to write error messages to a messagebox? I don't know if this is possible from a DLL, but if it is possible you don't need a console anymore and you don't need to pass back infornation to VB.
Walter Kramer
Would it be a solution to write error messages to a messagebox? I don't know if this is possible from a DLL, but if it is possible you don't need a console anymore and you don't need to pass back infornation to VB.
Walter Kramer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, a message box, using the MessageBox Win32 API routine, would work well for this. It works in all project types.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve, Can you post an example how to use messagebox in DLL? I really appreciate that. When I use console, the first time call DLL was ok, but second time, it gives me a GP fault and the program shut off.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried the example from reference manual, but I got the following error message:
Error: Error in opening the Library module file. [DFLIB]
use dflib
My codes was copied as below
I am using DF 5.0 D. Is this a problem?
Error: Error in opening the Library module file. [DFLIB]
use dflib
My codes was copied as below
! Build as QuickWin app use dflib message = MESSAGEBOXQQ('Do you want to continue?'C, & 'Matrix'C, & MB$ICONQUESTION.OR.MB$YESNO.OR.MB$DEFBUTTON1) END
I am using DF 5.0 D. Is this a problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A couple of things. First of all, I didn't say MESSAGEBOXQQ - I said MessageBox. These are two different routines, though they do mostly the same thing. But MESSAGEBOXQQ can be used from within a QuickWin application only.
Next, even given that, you should not have received the error you did - it suggests that Visual Fortran isn't installed correctly. Are you compiling from Developer Studio or a command prompt?
A simple example of a DLL routine that calls MessageBox is:
Next, even given that, you should not have received the error you did - it suggests that Visual Fortran isn't installed correctly. Are you compiling from Developer Studio or a command prompt?
A simple example of a DLL routine that calls MessageBox is:
subroutine mbox use dfwin implicit none !DEC$ ATTRIBUTES DLLEXPORT::mbox integer ret ret = MessageBox (NULL, "Hi! I'm a MessageBox!"C,"Sample"C,& MB_ICONINFORMATION+MB_OK) end subroutine mbox
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using developer studio. For your example, I got the following error message
--------------------Configuration: test1 - Win32 Debug--------------------
Compiling Fortran...
C:FortranFile est1 est1.f90
C:FortranFile est1 est1.f90(2) : Error: Error in opening the Library module file. [DFWIN]
use dfwin
------^
C:FortranFile est1 est1.f90(6) : Error: This name does not have a type, and must have an explicit type. [MESSAGEBOX]
ret = MessageBox (NULL, "Hi! I'm a MessageBox!"C,"Sample"C,&
--------^
Error executing df.exe.
test1.dll - 2 error(s), 0 warning(s)
--------------------Configuration: test1 - Win32 Debug--------------------
Compiling Fortran...
C:FortranFile est1 est1.f90
C:FortranFile est1 est1.f90(2) : Error: Error in opening the Library module file. [DFWIN]
use dfwin
------^
C:FortranFile est1 est1.f90(6) : Error: This name does not have a type, and must have an explicit type. [MESSAGEBOX]
ret = MessageBox (NULL, "Hi! I'm a MessageBox!"C,"Sample"C,&
--------^
Error executing df.exe.
test1.dll - 2 error(s), 0 warning(s)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It would appear that either you do not have the standard modules installed or your INCLUDE path is wrong. Go to Tools..Options..Directories..Show Directories for..Include files. There should be a path listed that ends with DFINCLUDE, and if you look at that folder (usually Program FilesDevStudioDFINCLUDE) it should contain DFWIN.MOD.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Steve. I did make a mistake in tools path. I also check the files you mentioned. DFwin.f90 and DFwin.mod are in correct directory. But it is still not working. Is it because my DF is 5.0 D? messagebox is not in help key word. Can you take a look? Thank you again. The error message is as below
--------------------Configuration: FCALL - Win32 Debug--------------------
Compiling Fortran...
C:FortranFileFcallFcall.f90
C:FortranFileFcallFcall.f90(21) : Error: The type of the actual argument differs from the type of the dummy argument. ['Do you want to continue?
message = MESSAGEBOX('Do you want to continue?'C, 'Matrix'C, MB$DEFBUTTON1)
---------------------^
C:FortranFileFcallFcall.f90(21) : Error: The type of the actual argument differs from the type of the dummy argument. [MB$DEFBUTTON1]
message = MESSAGEBOX('Do you want to continue?'C, 'Matrix'C, MB$DEFBUTTON1)
-------------------------------------------------------------^
C:FortranFileFcallFcall.f90(21) : Error: A non-optional actual argument must be present when invoking a procedure with an explicit interface. [UTYPE]
message = MESSAGEBOX('Do you want to continue?'C, 'Matrix'C, MB$DEFBUTTON1)
----------^
Error executing df.exe.
FCALL.dll - 3 error(s), 0 warning(s)
--------------------Configuration: FCALL - Win32 Debug--------------------
Compiling Fortran...
C:FortranFileFcallFcall.f90
C:FortranFileFcallFcall.f90(21) : Error: The type of the actual argument differs from the type of the dummy argument. ['Do you want to continue?
message = MESSAGEBOX('Do you want to continue?'C, 'Matrix'C, MB$DEFBUTTON1)
---------------------^
C:FortranFileFcallFcall.f90(21) : Error: The type of the actual argument differs from the type of the dummy argument. [MB$DEFBUTTON1]
message = MESSAGEBOX('Do you want to continue?'C, 'Matrix'C, MB$DEFBUTTON1)
-------------------------------------------------------------^
C:FortranFileFcallFcall.f90(21) : Error: A non-optional actual argument must be present when invoking a procedure with an explicit interface. [UTYPE]
message = MESSAGEBOX('Do you want to continue?'C, 'Matrix'C, MB$DEFBUTTON1)
----------^
Error executing df.exe.
FCALL.dll - 3 error(s), 0 warning(s)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error message should have tipped you off:
"Error: A non-optional actual argument must be present when invoking a procedure with an explicit interface."
You are missing an argument. Steve's sample shows 4 arguments and your implementation only three.
Sorry Steve for interrupting, but I couldn't resist
Walter Kramer
"Error: A non-optional actual argument must be present when invoking a procedure with an explicit interface."
You are missing an argument. Steve's sample shows 4 arguments and your implementation only three.
Sorry Steve for interrupting, but I couldn't resist
Walter Kramer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Walter, I don't think that was a problem. I copied Steve's code and ran. Here is the error message.
--------------------Configuration: test7 - Win32 Debug--------------------
Compiling Fortran...
C:FortranFile est7 est7.f90
Linking...
Creating library Debug/test7.lib and object Debug/test7.exp
test7.obj : error LNK2001: unresolved external symbol _MessageBoxA@16
Debug/test7.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
test7.dll - 2 error(s), 0 warning(s)
I am new with DF, please give me some advise.
--------------------Configuration: test7 - Win32 Debug--------------------
Compiling Fortran...
C:FortranFile est7 est7.f90
Linking...
Creating library Debug/test7.lib and object Debug/test7.exp
test7.obj : error LNK2001: unresolved external symbol _MessageBoxA@16
Debug/test7.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
test7.dll - 2 error(s), 0 warning(s)
I am new with DF, please give me some advise.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try adding this to your (Steve's) source:
!DEC$OBJCOMMENT LIB:"USER32.LIB"
hth,
John
!DEC$OBJCOMMENT LIB:"USER32.LIB"
hth,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
John, it works now. Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the assist, John. I forgot that that might be needed in V5 (it's not in V6).
Steve
Steve
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