Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

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

Report
"external" directive Posted by netgert on 2 May 2002 at 5:44 AM
Hi,

I'm using Borland Pascal 7.0 and I made a test DLL called "minmax.dll". Now I wanted to import functions from it. The code looks like this:

program _minmax;

function min(x, y: longint): longint; external 'minmax';
                                              {^}{Error 85: ";" expected}

begin
end.


What's wrong??? I made it by the BP's help. By the way, "minmax.pas" looks like this:

library minmax;

function min(x, y: longint): longint; export;
begin
  if x < y then min := x
  else min := y;
end;

function max(x, y: longint): longint; export;
begin
  if x > y then max := x
  else max := y;
end;

exports
  min,
  max;

begin
end.


And I've also compiled it (for protected mode of course). With QuickView the DLL is OK.

NetGert[/italic]

Report
Re: "external" directive Posted by zibadian on 2 May 2002 at 9:50 AM
: Hi,
:
: I'm using Borland Pascal 7.0 and I made a test DLL called "minmax.dll". Now I wanted to import functions from it. The code looks like this:
:
:
: program _minmax;
: 
: function min(x, y: longint): longint; external 'minmax';
:                                               {^}{Error 85: ";" expected}
: 
: begin
: end.
: 

:
: What's wrong??? I made it by the BP's help. By the way, "minmax.pas" looks like this:
:
:
: library minmax;
: 
: function min(x, y: longint): longint; export;
: begin
:   if x < y then min := x
:   else min := y;
: end;
: 
: function max(x, y: longint): longint; export;
: begin
:   if x > y then max := x
:   else max := y;
: end;
: 
: exports
:   min,
:   max;
: 
: begin
: end.
: 

:
: And I've also compiled it (for protected mode of course). With QuickView the DLL is OK.
:
NetGert[/italic]

:
Before the word external BP expects the word far; Then it can recognize the statement as a declaration for a DLL import. See online hep on external for more info.



 

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.