: hello there
:
: i have met a strange thing over the tp7 of mine.
: when i want to creat a dll file as i know instead of writing
: "program" or "unit" i should write "library"(as i seen in few sites and in the tp help section), but when i do it, it writes an error -"begin exprected" like it does not meet this word, althought when i write this word it brights in white as every reserved word.
:
: what should i do to make it build a dll?
:
: thanks
: dolev
:
:
:
Hello!
Rebember that Tp is a subset of the called Borland Pascal with Objects,
Actually you can not use a dll in the called real mode, this tool,
the Borland Pascal with Object, has the ability to create DPMI, DLLs, and windows apps.
You have to set the target in order to compile the dll, in the compile menu, to DPMI or windows aplication. TP does not have this options.
Also try borland pascal for windows 1.5.
library MinMax;
{The export procedure directive prepares Min and Max for exporting}
function Min(X, Y: Integer): Integer; export;
begin
if X < Y then Min := X else Min := Y;
end;
function Max(X, Y: Integer): Integer; export;
begin
if X > Y then Max := X else Max := Y;
end;
{The exports clause actually exports the two routines, supplying an
optional ordinal number for each of them}
exports
Min index 1,
Max index 2;
begin
end.
Time to use it!!!
program test; (*compiled in DMPI mode*);
var num1,num2:integer;
function Max(X, Y: Integer): Integer; far; external 'MinMax' index 2;
begin
writeln ('I am using the minmax dll library');
writeln ('Enter the firts number:');
readln (num1);
writeln ('Enter the second number:');
readln (num2);
writeln ('The max number is:',max(num1,num2));
end.
Sorry English is not my native language
Thank you for your time
Att: George.