#1 2017-01-30 15:03:05

adriany
Member
Registered: 2014-07-25
Posts: 12

Record too small error

Hello Arnaud,

I'm using your excellent mORMot library, specifically Client-Server services via interfaces as described in section 16 of the documentation.

But I am getting a "record too small" error, raised from line 52734 in mORMot.pas

        smvRecord:
          if ArgTypeInfo^.RecordType^.Size<=PTRSIZ then
            raise EInterfaceFactoryException.CreateUTF8(
              '%.Create: % record too small in %.% method % parameter',
              [self,ArgTypeName^,fInterfaceTypeInfo^.Name,URI,ParamName^]) else
            SizeInStorage := PTRSIZ; // handle only records when passed by ref
        else
          SizeInStorage := PTRSIZ;

An example record that causes this is:

  TMyRec =record
    Prop :string;
  end;

If I change it to:

  TMyRec =record
    Dummy: Integer;
    Prop :string;
  end;

It works.

But a simple record just containing a string should work in my opinion. Maybe the condition should be:

if ArgTypeInfo^.RecordType^.Size<PTRSIZ then

So less than and not less than or equals to? What do you think?


Thanks for a wonderful library!

Adrian

Offline

#2 2017-01-30 15:34:04

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

Re: Record too small error

The whole SOA process expects the record parameters to be passed by reference (i.e. as a pointer).
Writing < PTRSIZ would make access violations.
This is a limitation of the calling convention used by Delphi.

If your record contains only a string, pass a string parameter.
If you need a dedicated type, define a custom string type.

Offline

Board footer

Powered by FluxBB