#1 2014-11-06 09:00:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Add RTTI for interface

Our mORMot expects the interfaces to have RTTI for its methods, for SOA, MVC/MVVM and mock/stubs.
Sadly, FPC does not generate the RTTI available since Delphi 7!

The RTTI layout is well defined by
http://hallvards.blogspot.fr/2006/06/si … -rtti.html
http://hallvards.blogspot.fr/2006/08/ex … -rtti.html

This thread is for discussion about http://bugs.freepascal.org/view.php?id=26774

Offline

#2 2014-12-31 14:45:41

caiolrm
Member
Registered: 2014-12-29
Posts: 1

Re: Add RTTI for interface

For anyone interested, here's another useful link http://synopse.info/fossil/info/9357b49fe2a
I tried to contact Michael but he didn't respond, I guess this will be the only solution around.

Offline

#3 2015-01-01 00:01:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Add RTTI for interface

Yes, I didn't have any answer to my own requests either, sadly....

Offline

#4 2015-01-06 09:50:37

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Add RTTI for interface

First of all: Happy NewYear !
May the mORMot be as strong as ever in 2015 !!

Now for serious business:
Would it be an idea for me to follow up on the FPC dev-list ?
( http://lists.freepascal.org/pipermail/f … 34808.html )
Perhaps it will speed-up things.

Offline

#5 2015-01-06 10:19:39

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Add RTTI for interface

Yes - no news since November - last message thread is http://lists.freepascal.org/pipermail/f … 34824.html
Nothing happened at ncgrtti.pas level in the SVN thread since september...

I think I will implement the feature request workaround so that we would be able to generate interface information in Delphi, then compile it with FPC.
See http://synopse.info/fossil/tktview?name=9357b49fe2

Offline

#6 2015-07-15 19:41:13

fh
Member
Registered: 2013-04-03
Posts: 7

Re: Add RTTI for interface

We developed an application to manage queues of people needing care at a public hospital, for its various services, using mORMot framework and Delphi 7.
Last week we compiled the project done in Delphi 7 in a virtual machine with Xubuntu, FPC 3.1.1 and Lazarus 1.5. The compilation was successful and we have not encountered problems running the program until now. We had to make a small adjustment in the unit SynCrtSock.pas, class TCurlHTTP, function InternalSendRequest, as the GET method to obtain an array of records needs the parameters in the body and curl does not allow it unless the option coCustomRequest is used.
Congratulations on a great job. Regards

Offline

#7 2015-07-15 21:15:09

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Add RTTI for interface

@fh

Could you please share this modification of the curl library use?

Thanks for the feedback.

Offline

#8 2015-07-16 17:16:48

fh
Member
Registered: 2013-04-03
Posts: 7

Re: Add RTTI for interface

With pleasure:

procedure TCurlHTTP.InternalSendRequest(const aData: SockString);
begin // see [url]http://curl.haxx.se/libcurl/c/CURLOPT_CUSTOMREQUEST.html[/url]
  // libcurl has dedicated options for GET,HEAD verbs
  if (fIn.Method='') or (fIn.Method='GET') then begin
    curl.easy_setopt(fHandle,coHTTPGet,1);
    if (aData<>'') and (fIn.Method='GET') then begin // e.g. GET with body
      curl.easy_setopt(fHandle,coCustomRequest,pointer(fIn.Method));
      curl.easy_setopt(fHandle,coNoBody,0);
      curl.easy_setopt(fHandle,coUpload,1);
      fIn.Data := aData;
      fIn.DataOffset := 0;
      curl.easy_setopt(fHandle,coInFile,pointer(self));
      curl.easy_setopt(fHandle,coReadFunction,@CurlReadData);
      curl.easy_setopt(fHandle,coInFileSize,length(aData));
    end;
  end else
  if fIn.Method='HEAD' then
    curl.easy_setopt(fHandle,coNoBody,1) else begin
    // handle other HTTP verbs
    curl.easy_setopt(fHandle,coCustomRequest,pointer(fIn.Method));
    if aData='' then begin // e.g. DELETE or LOCK
      curl.easy_setopt(fHandle,coNoBody,1);
      curl.easy_setopt(fHandle,coUpload,0);
    end else begin // e.g. POST or PUT
      curl.easy_setopt(fHandle,coNoBody,0);
      curl.easy_setopt(fHandle,coUpload,1);
      fIn.Data := aData;
      fIn.DataOffset := 0;
      curl.easy_setopt(fHandle,coInFile,pointer(self));
      curl.easy_setopt(fHandle,coReadFunction,@CurlReadData);
      curl.easy_setopt(fHandle,coInFileSize,length(aData));
    end;
    InternalAddHeader('Expect:'); // disable 'Expect: 100 Continue'
  end;
  curl.easy_setopt(fHandle,coWriteFunction,@CurlWriteRawByteString);
  curl.easy_setopt(fHandle,coFile,@fOut.Data);
  curl.easy_setopt(fHandle,coHeaderFunction,@CurlWriteRawByteString);
  curl.easy_setopt(fHandle,coWriteHeader,@fOut.Header);
end;

Regards

Offline

#9 2015-07-17 18:09:55

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Add RTTI for interface

Offline

#10 2015-09-10 16:01:12

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Add RTTI for interface

A RTTI-flag is added into the FPC RTTI branch !

This allows for defines in the mORMot source !

FPC_HAS_EXTENDEDINTERFACERTTI

See: http://svn.freepascal.org/cgi-bin/viewv … sion=31583

Offline

#11 2015-10-18 19:24:40

linnemann
Member
Registered: 2015-10-18
Posts: 1

Re: Add RTTI for interface

Does this mean that we can soon use the complete mormot framework without having to go to delphi for the rtti generation?

I've briefly tested with fully updated rtti branch fpcup on win64 and using the sample 30 but it gives me a runtime error on FillRow

Error

Also have some failing tests.

Test

Url to test log

Test Log

and since this is my first post.
Thx for the work on making mormot avaliable to fpc.

Offline

#12 2015-10-18 20:28:25

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Add RTTI for interface

mORMot is not yet completely Win64bit compatible with FPC.

For now, use 32bit FPC and mORMot.
It should work as expected !

Last edited by AOG (2015-10-18 20:29:16)

Offline

#13 2015-11-23 12:53:34

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Add RTTI for interface

I would like to inform the mORMot users that I have successfully deployed a 64 bit mORMot ORM server with a MariaDB backend on an Amazon EC2 64 bit Arch Linux (free tier t2) instance !!
Everything runs as 64 bit (compiled with latest FPC). No lib32 trickery needed !!

And the speed of this very small t2 instance is very very good !!!! The save CPU cycles feature of Amazon is awfull. Network speed is incredible.
An AWS tier seems to be a very nice way of connection your mORMot with the world.

Offline

#14 2015-11-23 13:06:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Add RTTI for interface

Good news.

With sqlite3 as external .so, or statically linked?

Offline

#15 2015-11-23 13:34:40

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Add RTTI for interface

Dynamic linking ! For Linux servers, I normally use dynamic linking.

For (windows-) clients, I always use static.

With FPC on Windows, I am now using the trick to put a dll in a resoource, load it into memory at runtime, and use the dll from memory.
A bit of static, without the pain of static !

I need this trick when using mORMot clients that contact a MySQL (MariaDB) database directly: Amazon also offers an online RDBS service that works very well with mORMot.

Offline

#16 2015-11-26 11:25:00

ttomas
Member
Registered: 2013-03-08
Posts: 135

Re: Add RTTI for interface

FPC version 3.0.0 "Pestering Peacock" has been released!
Can someone confirm that FPC RTTI branch is included?

Offline

#17 2015-11-27 10:32:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: Add RTTI for interface

The RTTI branch was not included yet.

We asked for it, but AFAIK release time frame was not compatible with the inclusion.

Offline

#18 2016-01-21 07:03:55

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Add RTTI for interface

Fpcup now van apply a RTTI patch to get the RTTI needed for mORMot !

fpclazup.exe --fpcURL="trunk" --lazURL="trunk" --installdir="c:\fpctrunkrtti" --getfullrepo --fpcPATCH="fpcrtti.patch"

should give you a full featured FPC/Laz trunk combo capable of running the full mORMot !!

The patch should work on all FPC version >= 3.

Offline

#19 2016-01-21 07:56:57

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: Add RTTI for interface

AOG wrote:

Fpcup now van apply a RTTI patch to get the RTTI needed for mORMot !

fpclazup.exe --fpcURL="trunk" --lazURL="trunk" --installdir="c:\fpctrunkrtti" --getfullrepo --fpcPATCH="fpcrtti.patch"

should give you a full featured FPC/Laz trunk combo capable of running the full mORMot !!

The patch should work on all FPC version >= 3.

It is such a great news from you !

Is it possible to have a CodeTyphon distribution with RTTI out of the box ?

Offline

#20 2016-01-21 08:38:59

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Add RTTI for interface

AFAIK, CT does not have extented interface RTTI.
Patching CT is not that easy. It has its own installer.

But you can ask CT boss Sternas on the CT forum.
Normally, he is very helpfull.

Offline

#21 2016-02-19 11:22:03

shobits1
Member
Registered: 2016-02-10
Posts: 15

Re: Add RTTI for interface

AOG wrote:

Fpcup now van apply a RTTI patch to get the RTTI needed for mORMot !

fpclazup.exe --fpcURL="trunk" --lazURL="trunk" --installdir="c:\fpctrunkrtti" --getfullrepo --fpcPATCH="fpcrtti.patch"

should give you a full featured FPC/Laz trunk combo capable of running the full mORMot !!

The patch should work on all FPC version >= 3.

I think it is preferable to use the --fpcURL=RTTI instead of --fpcURL="trunk" --fpcPATCH="fpcrtti.patch" ; in my test case the RTTI brunch produced less error than the trunk + patch.

the --getfullrepo  can be discarded if you don't update your fpc/lazarus much and wanted to save some disk space.

I recommend using this:

fpclazup.exe --fpcURL=RTTI --lazURL=trunk --installdir="c:\fpctrunkrtti"

Last edited by shobits1 (2016-02-19 11:23:05)

Offline

Board footer

Powered by FluxBB