Recent

Author Topic: Synchronize @ or not ?  (Read 1788 times)

n2ic

  • New Member
  • *
  • Posts: 17
Synchronize @ or not ?
« on: July 29, 2016, 12:27:37 am »
I'm a Pascal/Lazarus newbie, so I'm sure this is obvious, but....

The code below gives me "Variable identifier expected" error on this line:

Synchronize(@ShowStatus);

But
Synchronize(ShowStatus);
without @ seems to work and build fine.

What's with that ?

Thanks !@

procedure TUdpThread.ShowStatus;
  var
     myStatusText : string;
  // this method is executed by the mainthread and can therefore access all GUI elements.
  begin
     myStatusText := fStatusText;
  end;

  procedure TUdpThread.Execute;
  var
    NewStatus : string;
  begin
    fStatusText := 'TMyThread Starting...';
    Synchronize(@ShowStatus);
    fStatusText := 'TMyThread Running...';               

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: Synchronize @ or not ?
« Reply #1 on: July 29, 2016, 12:30:08 am »
Delphi dialect: no @

(obj)fpc dialect: @


n2ic

  • New Member
  • *
  • Posts: 17
Re: Synchronize @ or not ?
« Reply #2 on: July 29, 2016, 12:38:36 am »
Thanks !

This was a Delphi project, converted to Lazarus, thus the {$MODE Delphi} .

 

TinyPortal © 2005-2018