I am working with gpc-20030507 (with gcc-3.2.3, i486-pc-mingw), and I have
noted two changes in compiler behavior from gpc-20021128. I don't know
whether these are bugs or intentionally revised features.
1. The "addr" function no longer observes the --no-typed-address command
line switch. The GPC manual says:
--no-typed-address
Make the result of the address operator an untyped pointer (same as
{$T-}).
...and:
Addr returns the address of its argument. It is equivalent to the
address operator....
...so I would expect that "addr" and "@" would behave the same. They did
under gpc-20021128. However, this now fails to compile with
"--no-typed-address":
program addrtest;
var i : integer;
a, b : ^ byte;
begin
a := @ i; { ok if --no-typed-address, fails otherwise }
b := addr (i); { fails always, "incompatible pointer type" }
end.
2. Using an interface-only module to declare routines in an exernal library
no longer works. The importing program declares an external to
"_init_<module-name>", but no entry point is provided by the module, so the
program won't link. The GPC manual says:
To use a function written in another language, you need to provide an
external declaration for it - either in the program, or in the
interface part of a unit, or an interface module.
So I would think that the following would work:
[ifmod.pas]
module ifmod interface;
export ifmod = (proc);
procedure proc;
end.
[iftest.pas]
program ifbug;
import ifmod (proc);
begin
proc
end.
They both compile but fail during linking (presuming a library is supplied
that declares "_Proc" as an entry point) with an undefined reference to
"init_Ifmod". This worked in gpc-20021128 because "iftest.o" did not
reference the "_init_Ifmod" entry point.
-- Dave