On 23 Mar 2003 at 20:54, Frank Heckenbach wrote:
I've uploaded a new alpha to http://www.gnu-pascal.de/alpha/
You will hate this release ... at least if you make heavy use of external declarations or other directives. We all knew that some backward-incompatible changes in this area would have to be made, now that's happened. PLEASE READ THE NOTES BELOW FOR DETAILS.
[...]
The compiler builds okay, under Mingw (no errors or anything like that). But there are problems - the testsuite won't run at all (and many trivial programs won't compile). I have just started investigating this. The first thing that comes up is the new syntax for asmname and stuff.
For example, in system.pas, this code: "procedure GlobalMemoryStatus (var Buffer: TMemoryStatus); attribute (stdcall, name = 'GlobalMemoryStatus');"
produces this result; c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/system.pas: In procedure `GlobalMemoryStatus': c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/system.pas:791: parse error before `to' c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/system.pas:328: unresolved forward declaration `DefaultAssertErrorProc' c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/system.pas:326: unresolved forward declaration `Assert' c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/system.pas:323: unresolved forward declaration `DoubleToComp' c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/system.pas:322: unresolved forward declaration `CompToDouble' c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/system.pas:321: unresolved forward declaration `MaxAvail' c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/system.pas:317: unresolved forward declaration `MemAvail' gpc1.exe: gpc exited with status 1
Now, if I change the code to: "procedure GlobalMemoryStatus (var Buffer: TMemoryStatus); external name 'GlobalMemoryStatus'; attribute (stdcall);"
or: "procedure GlobalMemoryStatus (var Buffer: TMemoryStatus); attribute (stdcall, name = 'GlobalMemoryStatus');external;"
the problem disappears. The important word here is "external". But the error message generated when it is missing seems misleading.
In dos.pas, the code: "{$define WINAPI(X) external name = X; attribute (stdcall)}"
produces this result: c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/dos.pas:697: parse error before `=' c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/dos.pas:152: unresolved forward declaration `SetVerify' c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/dos.pas:151: unresolved forward declaration `GetVerify' c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/dos.pas:150: unresolved forward declaration `SetCBreak' c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.2/units/dos.pas:146: unresolved forward declaration `GetCBreak' gpc1.exe: gpc exited with status 1
If I change it to: "{$define WINAPI(X) external name X; attribute (stdcall)}"
the problem goes away. So, the problem here is with the construct "external name = foo". If you remove the "=" and change it to "external name foo" then there is no problem.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/