Recent

Author Topic: LMessages - Lazarus 1.8.4 on MacOS  (Read 4041 times)

lelebass

  • New Member
  • *
  • Posts: 41
LMessages - Lazarus 1.8.4 on MacOS
« on: June 19, 2018, 11:59:39 am »
Dear All,
I recently come across a problem which I guess is a bug, but before filing a bug report I would like to understand better what is going on.

I tried to compile under MacOS 10.13.4 with Lazarus 1.8.4 a rather large code which is compiling without problems in the same MacOS with Lazarus 1.6.4.

The error which compiler raise is:

Error: Incompatible types: got "TYPES.TSmallPoint" expected "CLASSES.TSmallPoint"

The same code compile without issues under Windows with Lazarus 1.8.4.

Tracing the error, it seems that there is something wrong with some type declarations in LMessages.

I then created a very simple unit, which has only the offensive declaration:

uses
  LMessages;

procedure Dummy(Msg : TLMMouse);
var
  DummyPos : TSmallPoint;
begin
  DummyPos:=Msg.Pos;
end;

And I find the same behavior:

MacOS + Lazarus 1.6.4  OK
MacOS + Lazarus 1.8.4  ERROR

Error: Incompatible types: got "TYPES.TSmallPoint" expected "CLASSES.TSmallPoint"

Someone has an idea? If this is a bug, in which project of the bug tracking should I report it?  :-\

Ciao,
Daniele

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: LMessages - Lazarus 1.8.4 on MacOS
« Reply #1 on: June 19, 2018, 12:04:47 pm »
It's a known problem that has already been solved in development versions.

A quick fix is to change the order of classes and types in the uses list of the unit where it happens. If that isn't the case, just try to change the dummypos declaration to

 var dummy : types.tsmallpoint;

and add types to the uses list.
« Last Edit: June 19, 2018, 12:06:21 pm by marcov »

lelebass

  • New Member
  • *
  • Posts: 41
Re: LMessages - Lazarus 1.8.4 on MacOS
« Reply #2 on: June 19, 2018, 01:46:16 pm »
Thank you!

I will try to install the dev version, which is AFAIK also the most updated regarding cocoa.

Ciao,
Daniele

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: LMessages - Lazarus 1.8.4 on MacOS
« Reply #3 on: June 19, 2018, 02:51:31 pm »
Note that this is a Free Pascal issue. So you would need a development version of free pascal too.

lelebass

  • New Member
  • *
  • Posts: 41
Re: LMessages - Lazarus 1.8.4 on MacOS
« Reply #4 on: June 19, 2018, 04:25:20 pm »
Thank you again. I will try and report.  :)

Ciao,
Daniele

lelebass

  • New Member
  • *
  • Posts: 41
Re: LMessages - Lazarus 1.8.4 on MacOS
« Reply #5 on: June 19, 2018, 04:49:27 pm »
With Lazarus 1.8.4 adding Types between uses seems to solve the problem in both sample code and my application.

uses
  LMessages, Types;

Testing with dev will require some more time and efforts in order to get the dev running.  :-[

Ciao,
Daniele

Zoran

  • Hero Member
  • *****
  • Posts: 1824
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: LMessages - Lazarus 1.8.4 on MacOS
« Reply #6 on: June 19, 2018, 06:12:17 pm »
uses
  LMessages, Types;
When more than one unit contains same identifiers, compiler will take the one from the unit which appears last in the uses section.

I think it is better to avoid taking care of the order in uses list, so better prefix the type with unit name, as Marco suggested:
var dummy : types.tsmallpoint;

lelebass

  • New Member
  • *
  • Posts: 41
Re: LMessages - Lazarus 1.8.4 on MacOS
« Reply #7 on: June 22, 2018, 10:50:39 am »
I will follow your advice. Many thanks.

Ciao,
Daniele

 

TinyPortal © 2005-2018