I'm trying to have a DLL write to a Form from inside an application. The way I'm trying to do this is by using a procedural type and then passing it in as a variable to my DLL.
Here are some code snippets:
// [FROM THE APPLICATION .EXE]
type TStrProc = procedure(s : String);
type TProc = procedure(proc : TStrProc);
var DllTest : TProc;
// eg. load the library, etc, etc...
// ...
@DllTest := GetProcAddress(LibHandle, 'DllTest');
// ...
DllTest(@DisplayIt); // this should pass the address of my local procedure (DisplayIt) to the DLL.
--------------
// [FROM THE DLL]
type TProc = Procedure(s : String);
// ...
procedure DllTest(proc : TProc); stdcall;
begin
proc('This should be displayed on my main application's form.');
end;
--------------
However, when I run this program I am getting an Access Violation (Access Violation at address 008D1AA3. Write of address 0000000000.)
What am I doing wrong?
Thanks,
John