Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
dll problem... Posted by dolev9 on 25 Feb 2005 at 6:10 PM
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


Report
Re: dll problem... Posted by geergon on 2 Mar 2005 at 6:57 PM
: 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.
Report
Re: dll problem... Posted by dolev9 on 3 Mar 2005 at 9:33 AM
thx george for the help

dolev



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.