fpc/tests/test/library/ttdllexe.pp
pierre c4d43cfd59 * Restrict all tests to win32 and win64 targets
* Rename executables so the DLL are generated before.

git-svn-id: trunk@17788 -
2011-06-22 07:05:54 +00:00

54 lines
994 B
ObjectPascal

{ %target=win32,win64 }
{ %needlibrary }
{
Win32 DLL usage example. It needs testdll2.pp
This test checksq the windows abality to
export a function in an executable.
Here procedure TestExeProc is exported
and is imported by testdll2 DLL.
}
program ttdllexe;
uses
Windows;
procedure test; external 'testdll2' name 'test';
function GetString : string; external 'testdll2' name 'GetString';
var
s : string;external 'testdll2' name 'teststr';
const
called : boolean = false;
procedure TestExeProc;export;
begin
Writeln('Main: TestExeProc');
Writeln('Main: S is: "',s,'"');
called:=true;
end;
exports
TestExeProc;
begin
s:='Before test call';
Writeln('Main: S is: "',GetString,'"');
if (s<>GetString) then
begin
Writeln('Error in DLL variable handling');
halt(1);
end;
test;
Writeln('Main: S value after call is: "',s,'"');
if not called then
begin
Writeln('Error in DLL variable handling');
halt(1);
end;
end.