Recent

Author Topic: how to enable multihelpers class helpers  (Read 627 times)

mas steindorff

  • Hero Member
  • *****
  • Posts: 566
how to enable multihelpers class helpers
« on: February 13, 2026, 02:24:59 am »
I have a base class (TBinCmd) for handling command and some responses i.e byte array from another system.
A few of these commands and responses need advanced parsing and records to fully decode the response so I successfully added a helper to the tBinCmd class
Code: Pascal  [Select][+][-]
  1.  TCmd_UART = class helper for TBinCmd  // thelper
  2.      function Rsp2_UARTStr: string;
  3.      Class function GenCmd_UART(name:string):Boolean; // i.e. "115200,n,8,1,0"
  4.      function Rsp2_Uart_PramRec(var prm:TBaudPram):Boolean;
  5.    end;  
  6.  

the TBaudPram is a record that only aplies to a UART command so it's in it's own unit.
So far so good but when I add another helper in another unit, I get a complier error (as the wiki page says I would get). which helper fails depend on the order in my uses list but THE WIKI's  fix for this error ...
Code: Pascal  [Select][+][-]
  1. {$modeswitch multiscopehelpers}  
  2.  

is not working for me. 
I have placed this line at the top of both "helper" units as well as in my .lpr file but it is not affecting anything
I've also tried
Code: Pascal  [Select][+][-]
  1. {$modeswitch multihelpers}    
  2.  

without success (as posted in https://forum.lazarus.freepascal.org/index.php/topic,64505.msg490557.html#msg490557
can someone tell me what I'm doing wrong or where to place these modeswitch statements
PS: I also have {$MACRO ON} in these units if that has anything to do with this.
using IDE 3.4 FPC 3.22
Thankyou
MAS
windows 10 &11, Ubuntu 21+ IDE 3.4 general releases

dsiders

  • Hero Member
  • *****
  • Posts: 1556
Re: how to enable multihelpers class helpers
« Reply #1 on: February 13, 2026, 03:35:27 am »
Code: Pascal  [Select][+][-]
  1. $modeswitch multiscopehelpers}

I believe thar exists in FPC trunk (3.3.1) only.

mas steindorff

  • Hero Member
  • *****
  • Posts: 566
Re: how to enable multihelpers class helpers
« Reply #2 on: February 13, 2026, 07:03:20 pm »
I believe thay exists in FPC trunk (3.3.1) only.
thanks for the info. the wiki implied the $modeswitch came with the helpers around 2.2...  . I was wondering why this red word came with a red underline and warning.
windows 10 &11, Ubuntu 21+ IDE 3.4 general releases

PascalDragon

  • Hero Member
  • *****
  • Posts: 6356
  • Compiler Developer
Re: how to enable multihelpers class helpers
« Reply #3 on: February 14, 2026, 06:30:05 pm »
I have placed this line at the top of both "helper" units as well as in my .lpr file but it is not affecting anything

Aside from the modeswitch MultiHelpers (not MultiScopeHelpers) only existing in 3.3.1, it only needs to be placed in units that need to use multiple helpers, not when declaring them.

 

TinyPortal © 2005-2018