Recent

Author Topic: GR32 GR_Bindings problem  (Read 768 times)

staratel20

  • Full Member
  • ***
  • Posts: 215
GR32 GR_Bindings problem
« on: January 19, 2025, 01:05:36 pm »
Hi everyone!

I am encountering this problem when trying to compile my project, that uses GR32. It always breaks at this line:
     P := @(TFunctionBindingListCracker(FBindings).FItems); 

with Invalid typecast error. This is unit GR32_Bindings, initialization section of proc:
procedure TFunctionRegistry.RebindAll(PriorityCallback: TFunctionPriority); 

I successfully run GR32 examples, which uses this module and this line goes just fine. I've checked all checkboxes in the example compiler options to be assured that they are identical to my project, but problem still exist.

Does anyone know how to fix this?
Windows 7 SP1 x64, FPC 3.0.0, Lazarus from trunk: http://svn.freepascal.org/svn/lazarus/trunk

CountIdentity, ModeClassName - good property naming
IdentityCount,  ClassNameMode  - bad property naming

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12050
  • FPC developer.
Re: GR32 GR_Bindings problem
« Reply #1 on: January 19, 2025, 01:46:06 pm »
That part of code changed 6 months ago (https://github.com/graphics32/graphics32/blame/master/Source/GR32_Bindings.pas) when they mandatory required generics (no more pre unicode delphi?)

Code: Pascal  [Select][+][-]
  1. {$IFNDEF FPC}
  2.     Info := @FItems.List[i];
  3. {$ELSE}
  4.     Info := @(TFunctionInfoListCracker(FItems).FItems[i]);
  5. {$ENDIF}

Try to combine the delphi part of the ifdef with the FPC code.

Code: Pascal  [Select][+][-]
  1.     Info := @(TFunctionInfoListCracker(FItems).list[i]);

and similar for the p:= occurance.

Note the "list" instead of a second fitems.

staratel20

  • Full Member
  • ***
  • Posts: 215
Re: GR32 GR_Bindings problem
« Reply #2 on: January 20, 2025, 12:50:04 am »
I've tried to modify code like this:

{$IFNDEF FPC}
    P := @FBindings.List;
{$ELSE}
     // next line was modified to eliminate error
     P := @(TFunctionBindingListCracker(FBindings).List); 
{$ENDIF} 

but now I have:
GR32_Bindings.pas(453,1) Error: identifier idents no member "List"

more of it... it is still unclear for me, why example works with unmodified version while uses this unit
Windows 7 SP1 x64, FPC 3.0.0, Lazarus from trunk: http://svn.freepascal.org/svn/lazarus/trunk

CountIdentity, ModeClassName - good property naming
IdentityCount,  ClassNameMode  - bad property naming

PascalDragon

  • Hero Member
  • *****
  • Posts: 5870
  • Compiler Developer
Re: GR32 GR_Bindings problem
« Reply #3 on: January 20, 2025, 10:31:47 pm »
I've tried to modify code like this:

Please use [code=pascal][/code]-tags to avoid the forum software interpreting your code.

 

TinyPortal © 2005-2018