- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
I am trying to use a custom plot that I have made in Delphi from a Fortran program.
I have put the Delphi form into a dll and I call that dll from Fortran, but the form does not show correctly. First the form is "not responding" and does not repaint itself, and then after a while I get an empty window that does repaint itself, but does not show the contents of the form. When I call the dll from Delphi it works correctly.
On the Delphi side I have something like:
//---------------------------
library FormInDll;
uses
SysUtils,
Classes,
MFormInDll in 'MFormInDll.pas' {DllForm};
{$R *.res}
procedure ShowForm; stdcall;
begin
DllForm := TDllForm.Create(nil);
DllForm.Show;
end;
procedure HideForm; stdcall;
begin
DllForm.Free;
end;
exports
ShowForm,
HideForm;
begin
end.
//---------------------------
On the fortran side I first make a def file with the following contents:
LIBRARY FormInDll
EXPORTS
ShowForm
HideForm
I use this def file to make a lib file which I can include in my Fortran workspace in VS2005. In my Fortran project I define the interface to the suboutines in the dll:
program TestPlotDll
implicit none
interface
subroutine ShowForm
!DEC$ ATTRIBUTES STDCALL,DLLIMPORT,ALIAS:'_ShowForm' :: ShowForm
end subroutine
subroutine HideForm
!DEC$ ATTRIBUTES STDCALL,DLLIMPORT,ALIAS:'_HideForm' :: HideForm
end subroutine
end interface
write(*,*) 'Calling ShowForm'
call ShowForm
write(*,*) 'Call to ShowForm returned'
write(*,*) 'Press enter'
read(*,"()")
write(*,*) 'Calling HideForm'
call HideForm
write(*,*) 'Call to HideForm returned'
write(*,*) 'Press enter'
read(*,"()")
end program
I can compile and run the program, but as described above the Form does not respond correctly.
I use the above techniques to interface with a Delphi dll that does calculations but does not show any forms. I can pass arrays and strings back and forth to that dll and the calculations appear to work just fine. But I cannot figure out how to show forms. I will very much appreciate any help on this issue.
Best Regards and Thank You in Advance,
Stig Kildegrd Andersen
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Again
It turns out that there is nooneno-one handling the messages to the form in the console application. So to fix the problem either the Fortran application or the dll has to handle the messages. In Delphi one can start a separate thread to pocess the messages received by each form. In the end that was what I did.
Best Regards,
Stig

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page