Конференция "KOL" » modify a little code, kol can write win64 program
 
  • dotnet20 (26.02.14 10:45) [0]
    win7 x64, delphi xe2, KOL3.21
    ----------------------------------
    {$DEFINE x64} in project condition define
    ----------------------------------
    1)delphicommctrl.inc

       TMsg = packed record
       CASE Integer OF
       0:  (
           hwnd: HWND;
           message: UINT;
           {$IFDEF x64}
           _x64_DW1: DWORD;
           {$ENDIF}
           wParam: WPARAM;
           lParam: LPARAM;
           time: DWORD;
           pt: TPoint;
           {$IFDEF x64}
           _x64_DW2: DWORD;
           {$ENDIF}
           );
       //1:  ( Bmsg: Windows.TMsg; );
       2:  ( Cmsg: TMsgDecoded; );
       end;

    2)MsgDecode.pas
    ----------------------------------------------
     TMsgDecoded = packed record
       hwnd: HWND;
       Cmessage: TMessageDecoded;
       _filler: Word;
       {$IFDEF x64}
       _x64_DW1: DWORD;
       {$ENDIF}
       wParam: WPARAM;
       lParam: LPARAM;
       time: DWORD;
       pt: TPoint;
       {$IFDEF x64}
       _x64_DW2: DWORD;
       {$ENDIF}
     end;
  • dotnet20 (26.02.14 10:51) [1]
    if use {$DEFINE UNICODE_CTRLS},

    const "EditActions_Packed"  declare must modify, otherwise, editbox can't input any char
  • Netspirit (26.02.14 19:42) [2]
    This is because KOL disables aligning ({$A-}). Same with KOL.TMenuitemInfo.
    Why KOL redeclare this (e.g. not uses this records from Windows unit)...

    "Little code"? You are optimist :-)
  • dotnet20 (27.02.14 04:24) [3]
    I Only test my old progaram in win32, not fully test all controls.

    I can't undstand why kol define {$A-}, redeclare TMSG, this seems strange.

    I think win32, win64, unicode support compatible with delphi, freepacal is the most import things to KOL new version, 100-200bytes reduce is not the most import.
  • Дмитрий К © (27.02.14 07:59) [4]

    > I think win32, win64, unicode support compatible with delphi,
    >  freepacal is the most import things to KOL new version,
    >  100-200bytes reduce is not the most import.

    Then please try this http://yadi.sk/d/Z0uMP31_67nJY
    It is my adaptation of KOL for x64 delphi compilers and for fpc.
  • dotnet20 (28.02.14 12:19) [5]
    thanks a lot :)
  • Thaddy © (01.03.14 15:49) [6]
    Can we host that on kolmck.net as unofficial translation?
    I am interested in merging some of my 64bit code into it, but you beat me with a full version ;)

    I am sure Vladimir will have a look at it. (and can make it official)

    Will experiment with it in the weekend.

    Regards,

    Thaddy
  • thaddy © (01.03.14 16:02) [7]
    First test observation:

    Too much int64 instead of NativeInt. The code would be more compatible if you observe the native types. It would be possible to keep one source for both 32bit and 64bit. For older compilers we can define the NativeInt, NativeUINT etc types.
  • thaddy © (01.03.14 16:10) [8]
    Also, for both Freepascal and Delphi, {$DEFINE WIN64} is better than X64, because the compilers already understand that. After 5 minutes first compiled kol app based on kolappexpert ;-) Good work.
  • thaddy © (01.03.14 16:54) [9]
    Observation 2: simple kolform64 fpc:64000 bytes, DCC64:84992 bytes.
    FPC271 generates smaller code... ;-)
  • Thaddy © (02.03.14 08:23) [10]
    Of course I mean {$IFDEF WIN64}, not $DEFINE ...., because it is implicitly defined as WIN64.
    Also my kol notepad code runs in unicode 64 bit and I have no problems yet.
    Again, good work!
  • Дмитрий К © (03.03.14 00:57) [11]
    Thank you, Thaddy. Your opinion is much appreciated. But I'm afraid you were testing some other translation. In my version I use the type which is defined in FPC: PtrInt/PtrUInt, and I define it like this in kol.pas:
    {$IFNDEF FPC}
    type
    {$IFDEF WIN64}
     PtrUInt = NativeUInt;
     PtrInt = NativeInt;
     PPtrUInt = PNativeUInt;
     PPtrInt = PNativeInt;
    {$ELSE}
     PtrUInt = Cardinal;
     PtrInt = Integer;
     PPtrUInt = ^Cardinal;
     PPtrInt = ^Integer;
    {$ENDIF}
    {$ENDIF}

    .
    So my translation is compatible with the 32-bit compilers (even with D2, but this is thanks to Vladimir Kladov of course). And I don't use X64 symbol, only WIN64 as you suggested.

    And answering your question, yes you can host it on kolmck.net.
  • Thaddy © (03.03.14 17:57) [12]
    Ok, I will ask Vladimir to do that. You patch seems not intrusive and I have been playing with it all weekend ;-) Most, but not all of my projects (remember I do not use mck) compile with very little or no change....
    I will write a little article about it later today on fpc.thaddy.com.
    VERY good work.

    For those who want to test:

    Here's my commandline kolwhois for fpc2.7.1:
    c:\kolx64>ppcrossx64 -Mdelphi -Rintel -OpATHLON64 -CX -XX -Xs -O4 -Os -B  -CpATHLON64 -CfSSE3 -FuC:\fpc\trunk\packages\winunits-base\src;C:\fpc\trunk\packages\rtl-objpas\src\inc;C:\fpc\trunk\packages\rtl-objpas\src\win;C:\fpc\trunk\packages\rtl-extra\src\win -FiC:\fpc\trunk\packages\rtl-objpas\src\inc  whoiskol.dpr

    Note you need a fresh build from today/now , because Michael van Canneyt and me fixed winsock.pp 10 minutes ago ;) There will be more fpc side fixes when accepted, so the strange incompatibilities between delphi-win and fpc-win go away.
  • Thaddy © (03.03.14 17:57) [13]
    Ok, I will ask Vladimir to do that. You patch seems not intrusive and I have been playing with it all weekend ;-) Most, but not all of my projects (remember I do not use mck) compile with very little or no change....
    I will write a little article about it later today on fpc.thaddy.com.
    VERY good work.

    For those who want to test:

    Here's my commandline kolwhois for fpc2.7.1:
    c:\kolx64>ppcrossx64 -Mdelphi -Rintel -OpATHLON64 -CX -XX -Xs -O4 -Os -B  -CpATHLON64 -CfSSE3 -FuC:\fpc\trunk\packages\winunits-base\src;C:\fpc\trunk\packages\rtl-objpas\src\inc;C:\fpc\trunk\packages\rtl-objpas\src\win;C:\fpc\trunk\packages\rtl-extra\src\win -FiC:\fpc\trunk\packages\rtl-objpas\src\inc  whoiskol.dpr

    Note you need a fresh build from today/now , because Michael van Canneyt and me fixed winsock.pp 10 minutes ago ;) There will be more fpc side fixes when accepted, so the strange incompatibilities between delphi-win and fpc-win go away.
  • Thaddy © (04.03.14 20:58) [14]
    Dimitry, I put this on the fpc developers list:
    ----
    For anyone developing with KOL, Dmitry K did a - as yet unofficial - 64 bit Windows version that is sufficiently stable to be considered to be added to the official branch at kolmck.net.
    You can obtain it here: http://yadi.sk/d/Z0uMP31_67nJY

    If you are interested and know something about how to use KOL/MCK, plz test and let me know.

    Remember to compile with at least -Mdelphi  -Rintel -dPUREPASCAL
    Unicode version doesn't require -Mdelphiunicode but rather: -dUNICODE_CTRLS
    This is because KOL already had unicode before FPC.

    Thaddy

    p.s.:
    ppcrossx64 outperforms dcc64 in size and speed, at least with KOL.

    ---
  • Thaddy © (04.03.14 20:58) [15]
    Dimitry, I put this on the fpc developers list:
    ----
    For anyone developing with KOL, Dmitry K did a - as yet unofficial - 64 bit Windows version that is sufficiently stable to be considered to be added to the official branch at kolmck.net.
    You can obtain it here: http://yadi.sk/d/Z0uMP31_67nJY

    If you are interested and know something about how to use KOL/MCK, plz test and let me know.

    Remember to compile with at least -Mdelphi  -Rintel -dPUREPASCAL
    Unicode version doesn't require -Mdelphiunicode but rather: -dUNICODE_CTRLS
    This is because KOL already had unicode before FPC.

    Thaddy

    p.s.:
    ppcrossx64 outperforms dcc64 in size and speed, at least with KOL.

    ---
  • Дмитрий К © (04.03.14 22:26) [16]
    OK, thank you.
  • Awkward © (08.03.14 18:25) [17]
    KolEdb.pas, Err.pas не компилируются с этой версией KOL. Первый - ещё и потому, что в KOL.pas игнорируются ассемблерные функции
    function Int64_2Str( X: I64 ): AnsiString;
    function Int64_2Hex( X: I64; MinDigits: Integer ): KOLString;
    function Str2Int64( const S: AnsiString ): I64;
    function Int64_2Double( const X: I64 ): Double;
    function Double2Int64( D: Double ): I64;

  • Awkward © (08.03.14 18:27) [18]
    Поправка: не компилируется для FPC
  • Thaddy © (14.03.14 16:19) [19]
    err.pas is not translated for 64 bit, but the other functions should work. Also, fpc can now handle the asm code from kol. Can you give a small example that fails with fpc2.7.1 trunk?
 
Конференция "KOL" » modify a little code, kol can write win64 program
Есть новые Нет новых   [118241   +25][b:0][p:0.002]