attribute const: no warning?

Eike Lange eike.lange at uni-essen.de
Thu Apr 3 16:34:25 CEST 2003


Hi Folks!

By Compiling the following program with the given unit,
the compiler throws no warning but fails running.

program Foo;

uses MySQL;

begin
  WriteLn (MySQLOptConnectTimeout);
  MySQLOptConnectTimeout := 100;
  WriteLn (MySQLOptConnectTimeout);
end.

{ ======== }

unit MySQL;
interface
var
  MySQLOptConnectTimeout: Integer; 
    external name '_p_MYSQL_OPT_CONNECT_TIMEOUT'; attribute (const);
implementation
{$L mysqlc.c, mysqlclient}
end.

_p_MYSQL_OPT_CONNECT_TIMEOUT is defined as "const int" in a
C file.

What do I have to do to make GPC throwing at least one warning
like "accessing read only variable".

BTW: Is mixing of attributes allowed like this:
  MySQLOptConnectTimeout: Integer; 
    external; attribute (const, name ('_p_MYSQL_OPT_CONNECT_TIMEOUT'));

Eike




More information about the Gpc mailing list