Board index » delphi » Error message in D6 on GLScene code that works fine in D5...

Error message in D6 on GLScene code that works fine in D5...

After upgrading to Delphi 6 from D5 Pro we have experienced a problem
in compilation of a program that uses GLScene for graphics rendering.
Below is information on the problem:

1. error message during compilation:
[Error] GLScreen.pas(288): Variable name expected
[Fatal Error] GLSceneRegister.pas(39): Could not compile used unit
'GLScreen.pas'

2. Here is the actual code:

procedure RestoreDefaultMode;
// restores default desktop video mode
//Here is the problem:
var T : TDevMode absolute 0; // a little trick to create a nil pointer

begin
{Since the first parameter must be a var, we cannot use nil directly.
Instead we use a variable with an absolute address of 0.}
  ChangeDisplaySettings(T,CDS_FULLSCREEN);
end;

This part worked fine with Delphi 5 and it comes from GLScene without
modification by us...

Any suggestions on how to proceed?

Bo Berglund
bo.bergl...@telia.com

 

Re:Error message in D6 on GLScene code that works fine in D5...


This code is from the days that the Delphi compiler didn't allow typed
constants. In Delphi 6 you can simply replace:

var T : TDevMode absolute 0;

with:

const T: TDevMode = nil;

"Bo Berglund" <bo.bergl...@telia.com> schreef in bericht
news:3d18adf0.589371750@news.telia.net...

Quote
> After upgrading to Delphi 6 from D5 Pro we have experienced a problem
> in compilation of a program that uses GLScene for graphics rendering.
> Below is information on the problem:

> 1. error message during compilation:
> [Error] GLScreen.pas(288): Variable name expected
> [Fatal Error] GLSceneRegister.pas(39): Could not compile used unit
> 'GLScreen.pas'

> 2. Here is the actual code:

> procedure RestoreDefaultMode;
> // restores default desktop video mode
> //Here is the problem:
> var T : TDevMode absolute 0; // a little trick to create a nil pointer

> begin
> {Since the first parameter must be a var, we cannot use nil directly.
> Instead we use a variable with an absolute address of 0.}
>   ChangeDisplaySettings(T,CDS_FULLSCREEN);
> end;

> This part worked fine with Delphi 5 and it comes from GLScene without
> modification by us...

> Any suggestions on how to proceed?

> Bo Berglund
> bo.bergl...@telia.com

Other Threads