#1 2023-08-16 21:16:52

Mobius1
Member
Registered: 2023-08-16
Posts: 6

[Fixed] Trying to create a component that uses mORMot2

Hi,
I'm having issues trying to compile a delphi package that uses some units from mORMot2. I'm creating a component that is based on the suite but Delphi doesn't wanna compile it, it doesn't accept type = object for some reason. Detailed issue below:

I'm trying to create a package that creates a design-time component for mORMot2. Problem is, delphi keeps complaining about a type = object declaration on the code as shown in the image:
image.png

going through docwiki, I found out this segment that states object types are there only for backwards compatibility and shouldn't be used.
https://docwiki.embarcadero.com/RADStud … s_(Delphi)
image.png

In runtime the component works, it compiles and doesn't throw any errors, but if I try to create a .dpk to use the component in design time, then the package can't compile due to these errors, any Ideas on what I should do?

Last edited by Mobius1 (2023-09-08 21:28:43)

Offline

#2 2023-08-17 06:17:19

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

Re: [Fixed] Trying to create a component that uses mORMot2

Welcome.

Which version of Delphi are you using?

So you confirm that the code compiles usually, but not when compiled as a .dpk?
It is pretty weird, and clearly a compiler issue.

Offline

#3 2023-08-17 08:30:51

Mobius1
Member
Registered: 2023-08-16
Posts: 6

Re: [Fixed] Trying to create a component that uses mORMot2

11.3 Alexandria, but the same thing happens on 10.3.3 Rio, tested on this other version that I have installed here.

In runtime it compiles no problem, the .dpk throws the error. I want to create a design-time component using mORMot2, so for that It needs to compile in design-time as well... Asked on delphi global community about the issue but so far no one was able to help with the matter.

On lazarus it work like a charm, I have the component made beautifully, but on Delphi...

Offline

#4 2023-08-17 12:08:39

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

Re: [Fixed] Trying to create a component that uses mORMot2

I have made a huge refactoring to use record whenever possible.
https://github.com/synopse/mORMot2/commit/e29d7f28

Embarcadero is not good at all about backward compatibility.
"object" is still relevant - because it is not of the same memory model than "class".
What I wrote at https://blog.synopse.info/?post/2010/08 … -hegemony! is still relevant

Offline

#5 2023-08-17 13:18:34

wfbhappy
Member
Registered: 2022-02-16
Posts: 4

Re: [Fixed] Trying to create a component that uses mORMot2

改动很大

Online

#6 2023-08-17 13:22:56

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

Re: [Fixed] Trying to create a component that uses mORMot2

"Big changes", yes @wfbhappy

But thanks to the regression tests, we can be confident it should not break anything (or almost). wink

Offline

#7 2023-08-17 19:40:18

Mobius1
Member
Registered: 2023-08-16
Posts: 6

Re: [Fixed] Trying to create a component that uses mORMot2

Thanks! I will do some testing in a bit and will report the findings.

Offline

#8 2023-08-17 22:24:19

Mobius1
Member
Registered: 2023-08-16
Posts: 6

Re: [Fixed] Trying to create a component that uses mORMot2

Got a few other definition errors on mormot.crypt.core.pas, will do the same {$IFDEF} directives you made on the other units and will send a PR with the adjustments, only 2 types were not treated.

Offline

#9 2023-08-18 07:24:40

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

Re: [Fixed] Trying to create a component that uses mORMot2

Thanks!

Offline

#10 2023-09-08 21:28:23

Mobius1
Member
Registered: 2023-08-16
Posts: 6

Re: [Fixed] Trying to create a component that uses mORMot2

Apparently everything is working as intended, if I stumble upon some other issue I'll open another topic, thanks for the workaround to bypass Delphi's bug.

Offline

Board footer

Powered by FluxBB