I am a delphi noob so please help me out with this. I have created a DLL with the following code:
library PRdll;
uses
ExceptionLog, SysUtils,Classes,Dialogs;
{$R *.res}
function DllMessage(var a:integer):Integer;stdcall;export;
begin
Showmessage('GHelloa');//this is displayed
ShowMessage(IntToStr(a));//I get the error at this point
Result:=5;
end;
exports DllMessage;
begin
end.
The corresponding call to the DLL is given by this code:
var
FDll: TFDll;
function DllMessage(var a:integer):integer;stdcall;external 'PRDll.dll';
implementation
{$R *.dfm}
procedure TFDll.btnCallDllClick(Sender: TObject);
var
i:integer;
s1:string;
begin
i:=5;
s1:=IntToStr(DllMessage(i));
//ShowMessage(s1);
end;
I get an access error. Why does this happen . ANybody ? help!!!
Thanks in Advance
The correct code is posted below; i am surprised why no one could tell me this simple thing
This code has worked fine for me.