GNU Pascal Homepage - gpc - gpc-announce - gpc-de - gpc-doc
Diese Seite auf deutsch

Mail #6318

Back to main page of archive

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  

From: levi@localhost.nc3a.nato.int
Subject: calling c code from pascal
Date: 2 Aug 2001, 15:09:01

In pascal (unlike C and many other languages) you don't need (and
apparently shouldn't) use empty brackets after the function name if it
does not have arguments. The keyword allegro_init is explicitly stated to
be a function and parser clearly expects an argument here.
So your declaration should be:
function allegro_init:integer;asmname ...

George


On Thu, 2 Aug 2001, [iso-8859-1] Miguel Pérez E wrote:

> Hello, sorry if this is a trivial question.
>
> I´d like to use dzcomm library in my pascal program. It is necesary to first initialize allegro:
>
> ///****************************************//
> program Terminal;
>
> {$L c:\djgpp\allegro\src\allegro.c}
>
> function allegro_init() : integer; asmname 'allegro_init'; external;
>
> begin
>    allegro_init();
>    Writeln('Hola, esta es una prueba.');
>    readln;
> end.
> ///****************************************//
>
> but the gpc says:
>
> C:\DJGPP\allegro\dzcomm\term>gpc term2.pas --autobuild
> term2.pas:5: parse error before `)'
> term2.pas: In main program:
> term2.pas:8: parse error before `)'
> term2.pas:8: warning: function call as a statement - value is ignored
>
> What I am doing wrong?, or what switches do I have to set?
>
> Thank you for your help.
>
>
> Miguel Pérez E
> Development Engineer
> Primestone
> E-Mail: miguel.perez@primestone.com
> Tel:      (571) 6265432
> Fax:     (571) 6156377
>
>

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  


In reply to

Author Subject Date
Miguel Pérez E calling c code from pascal 2 Aug 2001, 16:59:04

Back to main page of archive


Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.

Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.


This page was created by Crystal 0.999 (Linux 2.4.27/i686).