Please see below ...
Joe.
-----Original Message----- From: Frank Heckenbach [SMTP:frank@g-n-u.de] Sent: Monday, January 21, 2002 1:59 AM To: gpc@gnu.de Subject: Re: Trouble using GPC modules
Nicolas Courtel wrote:
I'm trying to use the simple GPC modules mechanism, as described in the
Doc
(7.1.8.1, page 85), and can't figure out how to link the provided
example, with
module DemoMod3 and program ModDemo3.
I'm using GPC 20011202 on Solaris-8; I tried several methods, for
example:
% gpc --automake moddemo3.pas
and always get undefined linking errors:
Setfoo /var/tmp/cc2daawp1.o Getfoo /var/tmp/cc2daawp1.o
I guess the solution is really simple, but can't find it, please help!
Here's the example source code:
Works for me. Perhaps you need to specify the `asmname's (anyway, this will be required in the future when GPC will support qualified identifiers, so you might as well do it now, and perhaps it will solve your problem):
module DemoMod3;
type FooType = Integer;
var Foo : FooType;
procedure SetFoo (f : FooType); asmname 'setfoo'; procedure SetFoo (f : FooType);
[Joe da Silva]
OK, time for a silly question ... <g>
Why does the procedure header need to be given twice? (Looks weird!)
da Silva, Joe wrote:
procedure SetFoo (f : FooType); asmname 'setfoo'; procedure SetFoo (f : FooType);
[Joe da Silva]
OK, time for a silly question ... <g>
Why does the procedure header need to be given twice? (Looks weird!)
IMHO it doesn't look weird, but it looks just stupid. ;-) AFAIK, it's historical reasons (inherited from C or so).
We'll change this in the future (actually, Peter did so already for variables which had a similarly stupid syntax until some time ago, but he didn't get around to doing it for routines yet). Since it'll be an incompatible change, we'll not do it shortly before 2.1 now, though.
Frank