View Issue Details

IDProjectCategoryView StatusLast Update
0034022LazarusRTLpublic2018-07-27 05:50
ReporterPascal Riekenberg Assigned ToBart Broersma  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformi386OSWindows 10 x64 
Target Version1.8.6 
Summary0034022: Regression due to #0034008: Can't build Lazarus
DescriptionFix for 0034008 breaks build of Lazarus
Additional InformationSee attached patch for fixing this.
TagsNo tags attached.
Fixed in Revisionr58639
LazTarget-
Widgetset
Attached Files

Relationships

related to 0034008 resolvedMarco van de Voort FPC Invalid declaration of EnumFontFamiliesEx* 
has duplicate 0034034 closedBart Broersma Lazarus Error: (4025) Incompatible type for arg no. 3 ... 
has duplicate 0034103 resolvedBart Broersma Lazarus Lazarus IDE cannot be built with FPC trunk 

Activities

Pascal Riekenberg

2018-07-23 22:06

developer  

win32winapi.inc.patch (574 bytes)   
Index: win32winapi.inc
===================================================================
--- win32winapi.inc	(revision 58603)
+++ win32winapi.inc	(working copy)
@@ -1311,7 +1311,7 @@
   Rec.CallBack := CallBack;
   LFW.lfFaceName := UTF8ToUTF16(FontName);
   Result := LongInt(Windows.EnumFontFamiliesExW(DC,
-    LFW, windows.FontEnumExProc(@EnumExProcRedirW), Windows.LParam(@Rec), Flags));
+    LFW, windows.FontEnumExProcW(@EnumExProcRedirW), Windows.LParam(@Rec), Flags));
 end;
 
 {------------------------------------------------------------------------------
win32winapi.inc.patch (574 bytes)   

Cyrax

2018-07-24 02:21

reporter   ~0109644

This report should be moved to Lazarus side of the bugtracker.

wp

2018-07-24 14:27

developer   ~0109649

I just updated my Laz trunk to r58612, did a clean rebuild and did not experience any issues. (Win 10-1803/64 bit, fpc-3.0.4/32-bit). Your patch was NOT applied.

Pascal Riekenberg

2018-07-24 16:04

developer   ~0109650

Strange! Will check that later.

Bart Broersma

2018-07-24 17:00

developer   ~0109651

@wp: did you build with fpc trunk (r39480 or later)?

wp

2018-07-24 17:27

developer   ~0109652

> did you build with fpc trunk (r39480 or later)?

No, as I wrote, with fpc 3.0.4 - I thought this is primarily a Lazarus issue because the report was moved to the Lazarus project.

Pascal Riekenberg

2018-07-24 21:37

developer   ~0109663

I also just did a fresh checkout of fpc and lazarus. The issue still remains:
win32winapi.inc(1314,51) Error: Incompatible type for arg no. 3: Got "<procedure variable type of function(var ENUMLOGFONTEXA;var NEWTEXTMETRICEXA;LongInt;LongInt):LongInt;StdCall>", expected "<procedure variable type of function(var ENUMLOGFONTEXW;var NEWTEXTMETRICEXW;LongInt;LongInt):LongInt;StdCall>"

The issue was introduced due to a change in fpc trunk which also influences lazarus build.

Juha Manninen

2018-07-24 23:32

developer   ~0109667

The patch is no good. It does not even compile with a released version of FPC.

Bart Broersma

2018-07-25 00:33

developer   ~0109668

Last edited: 2018-07-25 00:54

View 5 revisions

It probably needs to be conditonal for trunk
  {$if fpc_fullversion < 30101} //or {$ifdef ver30}??
   Result := LongInt(Windows.EnumFontFamiliesExW(DC,
   LFW, windows.FontEnumExProc(@EnumExProcRedirW), Windows.LParam(@Rec), Flags));
  {$else}
   Result := LongInt(Windows.EnumFontFamiliesExW(DC,
   LFW, windows.FontEnumExProcW(@EnumExProcRedirW), Windows.LParam(@Rec), Flags));
  {$ifend}

Pascal Riekenberg

2018-07-25 05:56

developer   ~0109669

Last edited: 2018-07-25 06:57

View 2 revisions

Yes, if you need to compile lazarus trunk with other than fpc trunk it needs to be conditional.

Added new patch.

Pascal Riekenberg

2018-07-25 06:57

developer  

win32winapi.inc.2.patch (811 bytes)   
Index: lcl/interfaces/win32/win32winapi.inc
===================================================================
--- lcl/interfaces/win32/win32winapi.inc	(revision 58627)
+++ lcl/interfaces/win32/win32winapi.inc	(working copy)
@@ -1310,8 +1310,13 @@
   Rec.LParam := LParam;
   Rec.CallBack := CallBack;
   LFW.lfFaceName := UTF8ToUTF16(FontName);
+  {$if (FPC_VERSION < 3) or ((FPC_VERSION = 3) and (FPC_RELEASE < 1))}
   Result := LongInt(Windows.EnumFontFamiliesExW(DC,
     LFW, windows.FontEnumExProc(@EnumExProcRedirW), Windows.LParam(@Rec), Flags));
+  {$else}
+  Result := LongInt(Windows.EnumFontFamiliesExW(DC,
+    LFW, windows.FontEnumExProcW(@EnumExProcRedirW), Windows.LParam(@Rec), Flags));
+  {$endif}
 end;
 
 {------------------------------------------------------------------------------
win32winapi.inc.2.patch (811 bytes)   

Juha Manninen

2018-07-26 08:52

developer   ~0109680

The new patch will fail in far future when FPC 4.0 is released.
The test "fpc_fullversion < 30101" suggested by Bart soulds better.
Bart, can you please commit it.

Pascal Riekenberg

2018-07-26 09:13

developer   ~0109681

>The new patch will fail in far future when FPC 4.0 is released.
Why? If FPC_VERSION > 3 it will uses the else part, which is the new one!
But anyway, just change it as you like ;-)

Juha Manninen

2018-07-26 09:33

developer   ~0109682

> If FPC_VERSION > 3 it will uses the else part, which is the new one!

Oops, you are right. A temporary short-circuit in my head.

Bart Broersma

2018-07-26 12:51

developer   ~0109685

I'll try to commit later this day.
Mind you I did NOT test my suggestion with fpc trunk.
@Pascal: can you test with my patch from note 0109668?

Pascal Riekenberg

2018-07-26 14:09

developer  

win32winapi.inc.3.patch (772 bytes)   
Index: lcl/interfaces/win32/win32winapi.inc
===================================================================
--- lcl/interfaces/win32/win32winapi.inc	(revision 58636)
+++ lcl/interfaces/win32/win32winapi.inc	(working copy)
@@ -1310,8 +1310,13 @@
   Rec.LParam := LParam;
   Rec.CallBack := CallBack;
   LFW.lfFaceName := UTF8ToUTF16(FontName);
+  {$if fpc_fullversion < 30101}
   Result := LongInt(Windows.EnumFontFamiliesExW(DC,
     LFW, windows.FontEnumExProc(@EnumExProcRedirW), Windows.LParam(@Rec), Flags));
+  {$else}
+  Result := LongInt(Windows.EnumFontFamiliesExW(DC,
+    LFW, windows.FontEnumExProcW(@EnumExProcRedirW), Windows.LParam(@Rec), Flags));
+  {$endif}
 end;
 
 {------------------------------------------------------------------------------
win32winapi.inc.3.patch (772 bytes)   

Pascal Riekenberg

2018-07-26 14:10

developer   ~0109687

@Bart: tested with fpc trunk -> okay
Added patch.

Bart Broersma

2018-07-26 22:49

developer   ~0109695

The same code fragment also exists in CustomDrawn WS, so I adjusted that too.

Please test with fpc trunk and close if OK.

Pascal Riekenberg

2018-07-27 05:50

developer   ~0109698

Thanks

Issue History

Date Modified Username Field Change
2018-07-23 22:06 Pascal Riekenberg New Issue
2018-07-23 22:06 Pascal Riekenberg File Added: win32winapi.inc.patch
2018-07-24 02:21 Cyrax Note Added: 0109644
2018-07-24 02:54 J. Gareth Moreton Relationship added related to 0034008
2018-07-24 09:19 Marco van de Voort Project FPC => Lazarus
2018-07-24 14:27 wp Note Added: 0109649
2018-07-24 16:04 Pascal Riekenberg Note Added: 0109650
2018-07-24 17:00 Bart Broersma Note Added: 0109651
2018-07-24 17:27 wp Note Added: 0109652
2018-07-24 21:37 Pascal Riekenberg Note Added: 0109663
2018-07-24 23:32 Juha Manninen Note Added: 0109667
2018-07-25 00:33 Bart Broersma Note Added: 0109668
2018-07-25 00:51 Bart Broersma Note Edited: 0109668 View Revisions
2018-07-25 00:51 Bart Broersma Note Edited: 0109668 View Revisions
2018-07-25 00:53 Bart Broersma Note Edited: 0109668 View Revisions
2018-07-25 00:54 Bart Broersma Note Edited: 0109668 View Revisions
2018-07-25 05:56 Pascal Riekenberg Note Added: 0109669
2018-07-25 06:57 Pascal Riekenberg File Added: win32winapi.inc.2.patch
2018-07-25 06:57 Pascal Riekenberg Note Edited: 0109669 View Revisions
2018-07-26 00:02 Bart Broersma Relationship added has duplicate 0034034
2018-07-26 08:52 Juha Manninen Note Added: 0109680
2018-07-26 09:13 Pascal Riekenberg Note Added: 0109681
2018-07-26 09:33 Juha Manninen Note Added: 0109682
2018-07-26 12:50 Bart Broersma Assigned To => Bart Broersma
2018-07-26 12:50 Bart Broersma Status new => assigned
2018-07-26 12:51 Bart Broersma Note Added: 0109685
2018-07-26 12:51 Bart Broersma LazTarget => -
2018-07-26 12:51 Bart Broersma Status assigned => feedback
2018-07-26 14:09 Pascal Riekenberg File Added: win32winapi.inc.3.patch
2018-07-26 14:10 Pascal Riekenberg Note Added: 0109687
2018-07-26 14:10 Pascal Riekenberg Status feedback => assigned
2018-07-26 22:49 Bart Broersma Fixed in Revision => r58639
2018-07-26 22:49 Bart Broersma Note Added: 0109695
2018-07-26 22:49 Bart Broersma Status assigned => resolved
2018-07-26 22:49 Bart Broersma Resolution open => fixed
2018-07-26 22:49 Bart Broersma Target Version => 1.8.6
2018-07-27 05:50 Pascal Riekenberg Note Added: 0109698
2018-07-27 05:50 Pascal Riekenberg Status resolved => closed
2018-08-09 17:58 Bart Broersma Relationship added has duplicate 0034103