Hi, can someone help me? :)
I'm using Delphi2010 & windows 7.
The problem is:
I want to create DLL that exports function showing form with
AdvStringGrid. So my host application loads this DLL, calls function and
releases the library. After that I get AV. If I show form without
AdvStringGrid, i had no problem.
Steps to reproduce:
- run Delphi, create 2 projects : VCL Application (testApp.exe) & DLL Library (test.dll);
- Add procedure to dll:
procedure ShowForm(); stdcall;
var f : TForm;
begin
f := TForm.Create(nil);
f.ShowModal();
f.Free;
end;
exports
ShowForm;
we have to add Forms unit to uses section;
3. next step: loading library in host application:
add the TButton and ButtonClick event like this:
procedure TForm1.Button1Click(Sender: TObject);
type TShowFormProc = procedure; stdcall;
var libHandle : THandle;
showForm : TShowFormProc;
begin
libHandle := LoadLibrary('test.dll');
@ShowForm := GetProcAddress(libHandle, 'ShowForm') ;
ShowForm();
freeLibrary(libHandle);
end;
so, all work fine, without any problems.
But I want to use AdvancedStringGrid in my library. so I add AdvGrid unit. I don't have to do something else. After including AdvGrid I have AV in ButtonClick event.
Seems there is problem in initialization & finalization part of these units, so can someone tell me: how to use TMS Components in DLLs?
Don't think that it is specific problem of TMS Grid, so I've posted this message in "General" section.
Thanks,
Terekhov Andrew,
Petrozavodsk State University
teran (at) psu.karelia.ru