#1 2019-08-26 21:52:01

JuanK
Member
Registered: 2019-08-26
Posts: 6

FPC/LAZARUS/Mormot Newbie needs help on chat demo [SOLVED!!!]

Hi,

I usually works with delphi, but now I need to write a chat program for windows and Linux, so I'm tryng to use Lazarus for this task.  I  have been reading about mormot, and I liked more the more I read about it. 

I'm trying to use mORMot\SQLite3\Samples\31 - WebSockets Chat Client/Server demos (only available as delphi dpr) , as it look great as a base for my program

Using Delphi 10.3.1 and last version of mormot it compiled and worked perfectly,

but,

I downloaded last lazarus 2.04 / mormot versions, used lazarus import to convert project Project31ChatClient.lpr and compiled it.  It shows  'Erorr: identifier not found : AlignTypeData' on SynFPCTypInfo.pas

Original code:

{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
function AlignToPtr(p : pointer): pointer; inline;
begin
  result := align(p,sizeof(p));
end;
{$endif}

function GetFPCTypeData(TypeInfo: PTypeInfo): PTypeData;
begin
  result := PTypeData(TypInfo.AlignTypeData(PTypeData(pointer(TypeInfo)+2+PByte(pointer(TypeInfo)+1)^)));
end; 


I tryed Defining FPC_REQUIRES_PROPER_ALIGNMENT and using what I believed to be the correct function in lazarus (changing TypInfo.AlignTypeData ocurrences with  AlignToPtr),

compile and get error Error identifier not found 'TLibHandle', so I add uses dynlibs, now compile give me errors undefined symbols memcpy, memset, malloc, free,
so I search in mormot code and found the definicion in threee units SynCrypto.pas, SynSQLite3Static.pas and SynZLibSSE.pas, So I add 'uses SynSQLite3Static' and it finally compiles with 10 warning and 246 sugestions

I run the program in DOS window and it gave me:

An unhandled exception occurred at $00000001000D7E4F:
EInterfaceResolverException: TInterfaceResolverInjected.RegisterGlobal(): TAutoLocker does not implement IAutoLocker
  $00000001000D7E4F line 58449 of ../../mORMot.pas
  $00000001000D7FFD line 58466 of ../../mORMot.pas
  $00000001000E33E4 line 63304 of ../../mORMot.pas
  $000000010000D531
  $00000001000022EE line 77 of Project31ChatClient.lpr
  $0000000100002366
  $0000000100013933
  $0000000100014461
  $00007FF804917BD4
  $00007FF80552CE71

I also look in internet and found a conversion of client / server to lazarus projects in

https://github.com/synopse/mORMot/tree/ … WebSockets

Using the more recent ones (from 2 years ago) I compile and get 93 warnings, 2085 sugestions

I run the program in DOS window and it gave me EXACTLY the same as previous DOS program, if I use the original SynFPCTypInfo.pas it again shows the same mistakes

Also tryed with fpcupdeluxe, lazarus version 2.02 and same results..

As you see I tryed, but I don't now what to do now, I really likes how well it works in delphi and how simple mormot is, but I need to use lazarus to compile to linux...

Can anyone help me?  Working client project in lazarus / mormot last versions would be great, but anything you can do to help me would be appreciated

Thanks in advance.

(Sorry for my bad english)

Last edited by JuanK (2019-08-30 05:50:17)

Offline

#2 2019-08-27 03:24:29

JuanK
Member
Registered: 2019-08-26
Posts: 6

Re: FPC/LAZARUS/Mormot Newbie needs help on chat demo [SOLVED!!!]

Solved!!!

I download last version of NewPascal.zip and it compiled and worked!!!

Thanks for your time reading this...

Offline

#3 2019-08-27 07:37:10

Bsaidus
Member
From: Algeria
Registered: 2018-12-16
Posts: 50

Re: FPC/LAZARUS/Mormot Newbie needs help on chat demo [SOLVED!!!]

JuanK wrote:

Solved!!!

I download last version of NewPascal.zip and it compiled and worked!!!

Thanks for your time reading this...



No, NewPascal is not more maintained, I recommand you to use fpcupdeluxe ( https://github.com/LongDirtyAnimAlf/fpc … e/releases ) to install fpc 3.2 fixes with lazarus 2.0.4 fixes or read the following
https://synopse.info/forum/viewtopic.php?id=4895

Offline

#4 2019-08-27 21:33:49

JuanK
Member
Registered: 2019-08-26
Posts: 6

Re: FPC/LAZARUS/Mormot Newbie needs help on chat demo [SOLVED!!!]

Thank you BSaidus, I follow your recommendation and use fpcupdeluxe to install last versión of fixes (FPC Fixes 3.2 and Lazarus Fixes 2.0) and it worked!, now I have a working and updated copy smile

Offline

Board footer

Powered by FluxBB