#1 2013-01-23 01:13:18

Martin Sedgewick
Member
Registered: 2013-01-23
Posts: 12

Delphi 6 mORMot.pas compile issue (v1.18)

Hi,

I want to start integrating mORMot into our existing codebase and I thought the first thing I would do is use the TInterfaceMock/TInterfaceStub as it will be really helpful in the short term.

I am using Delphi 6, and I have an existing unit test project. I added mORMot.pas and When compiling I get:

[Fatal Error] mORMot.pas(31557): Internal error: URW699

I think as you test with Delphi 6, it may be how I have the synopse.inc file set up. I have tried to read through the forum and the documentation but could not find any solution to setting up for Delphi 6.

I have uninstalled most 3rd party IDE extensions like CNWizards and even tried just loading and running the sample/demo projects but I get the same issues.

Any help with this would be great, I am really eager to get into the framework.

Martin

Offline

#2 2013-01-23 10:49:38

Martin Sedgewick
Member
Registered: 2013-01-23
Posts: 12

Re: Delphi 6 mORMot.pas compile issue (v1.18)

I am trying to find the point where the compilation breaks.

I am starting here, where I can compile in SQLite3Commons.

2012-10-16
12:49   
[f8dac6147e] speed up of TDynArrayHashed hashing process (user: abouchez, tags: trunk)

Offline

#3 2013-01-23 11:00:44

Martin Sedgewick
Member
Registered: 2013-01-23
Posts: 12

Re: Delphi 6 mORMot.pas compile issue (v1.18)

This is the commit which introduces the compile issue in Delphi 6.

2012-11-14

16:20   
[2543c7d420]
added process of Variant and WideString types in TSQLRecord properties (as sftVariant and sftRaWUYTF8)
TSQLPropInfo*.SetValue() now expect an additional wasString: boolean parameter
TSQLPropInfo*.SameValue() is replaced by more versatile TSQLPropInfo*.CompareValue()
(user: abouchez, tags: trunk)

Offline

#4 2013-01-23 11:27:10

Martin Sedgewick
Member
Registered: 2013-01-23
Posts: 12

Re: Delphi 6 mORMot.pas compile issue (v1.18)

I have tracked the compile issue to the following line:

function TSQLPropInfoRTTIVariant.GetHash(Instance: TObject; CaseInsensitive: boolean): cardinal;
...
   varInt64, varDouble, varDate, varCurrency:
     result := Int64Rec(VInt64).Lo xor Int64Rec(VInt64).Hi;  <-- this one

Offline

#5 2013-01-23 12:33:30

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

Re: Delphi 6 mORMot.pas compile issue (v1.18)

Ho!

I just found out the same!!!!!

Weird compilation issue.

Has been fixed by http://synopse.info/fossil/info/93755cddb8
(another issue about regression tests was fixed)

Online

#6 2013-01-23 12:44:25

Martin Sedgewick
Member
Registered: 2013-01-23
Posts: 12

Re: Delphi 6 mORMot.pas compile issue (v1.18)

Thank you very much!

That was fast and efficient service smile

Offline

#7 2013-01-23 12:53:30

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

Re: Delphi 6 mORMot.pas compile issue (v1.18)

Sorry for the inconvenience.

I did not check Delphi 6 compilation on the unstable 1.18 branch since november 2012!
My mistake.

Congratulation to have tracked the erroneous line.
Such issues are not easy to track!

Online

#8 2013-01-23 15:42:44

Martin Sedgewick
Member
Registered: 2013-01-23
Posts: 12

Re: Delphi 6 mORMot.pas compile issue (v1.18)

No problem on finding the issue, just took a little time.

I am trying to use TInterfaceStub/Mock in some code and the documentation says:

TInterfaceStub.Create(TypeInfo(ISmsSender),SmsSender).
    Returns('Send',[true]);

when I put my own interface in place of ISMSSender, I get "IMYINTERFACE interface has no RTTI"

This comes from constructor TInterfaceFactory.Create(aInterface: PTypeInfo);

Is this possible in Delphi 6. RTTI is not something I know a lot about and I am not sure if I can get type info on an interface through another way.

Offline

#9 2013-01-23 15:47:43

Martin Sedgewick
Member
Registered: 2013-01-23
Posts: 12

Re: Delphi 6 mORMot.pas compile issue (v1.18)

I realise my mistake. my interface needs to inherit from IInvokable which has {$m+} and my interface will get RTTI.

I am, however, using COM interfaces which do not inherit from IInvokable, but IUknown....:(

Offline

#10 2013-01-23 15:54:57

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

Re: Delphi 6 mORMot.pas compile issue (v1.18)

What if you add $M+ to your COM interfaces before their definition???
I do not known if it is possible.
Or create a IInvokable interface with the same exact members and GUID?

In all cases, our factories need the RTTI to be available, otherwise, they are not able to stub/mock anything, by definition.
sad

Online

#11 2013-01-23 16:32:05

Martin Sedgewick
Member
Registered: 2013-01-23
Posts: 12

Re: Delphi 6 mORMot.pas compile issue (v1.18)

Yes, I can add {$M+} into COM definitions which will work,

but we use TGUID a lot in our COM interfaces and TGUID does not have RTTI....so yet another problem.

Change all interfaces to not use TGUID and make the code cast string <-> guid everywhere or have no interface mocking?

I do not know, I will think about it.

Last edited by Martin Sedgewick (2013-01-23 16:32:46)

Offline

#12 2013-01-23 16:37:35

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

Re: Delphi 6 mORMot.pas compile issue (v1.18)

I do not understand your point "TGUID does not have RTTI".
For me, you can have GUIDs for interface and RTTI.

RTTI is just some Delphi-specific compile-time information, and should be able to be mixed with COM.

Or perhaps I missed something.

Online

#13 2013-01-23 17:00:26

Martin Sedgewick
Member
Registered: 2013-01-23
Posts: 12

Re: Delphi 6 mORMot.pas compile issue (v1.18)

in Delphi 6, Delphi cannot generate RTTI for records and TGUID is a packed record.

so in our COM interfaces we have the following:

function Object_(ID: TGUID): IObjectInfo; safecall;

This is allowed in COM, but as TGUID cannot have RTTI generated, I cannot compile my code with {$m+} around the interface.

This has been solved in Delphi 2010.


To solve this I would need to replace the TGUID with a string or other type to pass.

function Object_(ID: WideString): IObjectInfo; safecall;

then cast this to GUID on each side. This is uglier code but allows me to use TInterfaceMock.

So I think we will leave COM interfaces as current manually made mocks (using pascalmocks) and change to use your TInterfaceMock for normal interfaces.

Thanks for the help.

Last edited by Martin Sedgewick (2013-01-23 17:02:09)

Offline

Board footer

Powered by FluxBB