Forum > General

RTL Namespaces

<< < (6/7) > >>

DonaldShimoda:
So, thereĀ“s a strong decision in no support for this naming. Or any change on this (old) topic? I have a lot of Delphi 10 code to use on FPC for arm. Must put a lot of ifdef? Or theres a more elegant solution?

marcov:
No ifdef, just remove all namespaces in the source, and then set the default namespace in the delphi IDE to compensate that, and presto it works on both.

KodeZwerg:
In Delphi I do since years....

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$IF Defined(DCC) or Defined(VER210) or Defined(VER200) or Defined(VER190) or Defined(VER185) or Defined(VER180) or Defined(VER170) or Defined(VER160) or Defined(VER150) or Defined(VER140) or Defined(VER130) or Defined(VER120) or Defined(VER100) or Defined(VER90) or Defined(VER80)}  {$DEFINE Delphi} { Delphi }{$IFEND} {$IF Defined(DELPHI) and Declared(CompilerVersion) and (CompilerVersion >= 23)}  {$DEFINE NameSpace} { Delphis NameSpace feature (eg Winapi.Windows instead of Windows) }{$IFEND} {$IF Defined(WIN32) or Defined(WIN64) or Defined(MSWindows)}  {$DEFINE Windows} { We are on Windows }{$IFEND Windows}...via include file

Since I started not that long ago to use also FreePascal my unit header looking like this (exemplary)

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$IFDEF DELPHI}  {$IFDEF NameSpace}    {$IFDEF Windows}      Winapi.Windows,    {$ENDIF Windows}    System.SysUtils, System.Classes,    Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls,  {$ELSE NameSpace}    {$IFDEF Windows}      Windows,    {$ENDIF Windows}    SysUtils, Classes,    Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls,  {$ENDIF NameSpace}{$ENDIF DELPHI}{$IFDEF FPC}  {$IFDEF Windows}    Windows,  {$ENDIF Windows}  SysUtils, Classes,  Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls,{$ENDIF FPC}

DonaldShimoda:

--- Quote from: marcov on February 23, 2023, 09:03:08 am ---No ifdef, just remove all namespaces in the source, and then set the default namespace in the delphi IDE to compensate that, and presto it works on both.

--- End quote ---

Not so easy. VCl and FMX have sense on delphi. And i prefer to not lose delphi compatibility.

So ifdef is the only way.

marcov:

--- Quote from: DonaldShimoda on February 23, 2023, 02:55:43 pm ---
--- Quote from: marcov on February 23, 2023, 09:03:08 am ---No ifdef, just remove all namespaces in the source, and then set the default namespace in the delphi IDE to compensate that, and presto it works on both.

--- End quote ---

Not so easy. VCl and FMX have sense on delphi. And i prefer to not lose delphi compatibility.

--- End quote ---

For me FMX never made sense on Delphi. btw: I started originally with this scheme because I had XE at home, but XE3 at work, nothing to do with FPC.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version