#1 2017-03-28 03:30:29

Del
Member
Registered: 2017-03-24
Posts: 20

Delphi package using mormot compiler error

I built some classes (based on TWinHTTP + other) and used it in a Delphi app but would like to separate these into a Delphi package. When I do this however the exact same code (that compiles fine as an app) throws numerous errors related to mormot.

Errors as follows,

[DCC Error] SynBidirSock.pas(755): E1025 Unsupported language feature: 'Object'
[DCC Error] SynBidirSock.pas(803): E1025 Unsupported language feature: 'Object'
[DCC Error] SynBidirSock.pas(821): E1025 Unsupported language feature: 'Object'
[DCC Error] SynBidirSock.pas(847): E1025 Unsupported language feature: 'Object'
[DCC Error] SynBidirSock.pas(926): E1025 Unsupported language feature: 'Object'
[DCC Error] SynBidirSock.pas(1054): E1025 Unsupported language feature: 'Object'
[DCC Error] SynSSPI.pas(100): E1025 Unsupported language feature: 'Object'
[DCC Error] SynSSPI.pas(106): E1025 Unsupported language feature: 'Object'
[DCC Error] SynSSPI.pas(109): E1025 Unsupported language feature: 'Object'
[DCC Error] SynSSPI.pas(115): E1025 Unsupported language feature: 'Object'
[DCC Error] mORMot.pas(2388): E1025 Unsupported language feature: 'Object'
[DCC Error] mORMot.pas(2404): E1025 Unsupported language feature: 'Object'
[DCC Error] mORMot.pas(3690): E1025 Unsupported language feature: 'Object'
[DCC Error] mORMot.pas(4771): E1025 Unsupported language feature: 'Object'
[DCC Error] mORMot.pas(4854): E1025 Unsupported language feature: 'Object'
[DCC Error] mORMot.pas(8915): E1025 Unsupported language feature: 'Object'
[DCC Error] mORMot.pas(8911): E1025 Unsupported language feature: 'Object'
[DCC Error] mORMot.pas(8915): E1025 Unsupported language feature: 'Object'
[DCC Error] mORMot.pas(10726): E1025 Unsupported language feature: 'Object'
[DCC Error] mORMot.pas(16072): E1025 Unsupported language feature: 'Object'
[DCC Error] mORMot.pas(16081): E1025 Unsupported language feature: 'Object'

Am I missing some directives or something similar?

Offline

#2 2017-03-28 06:49:47

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

Re: Delphi package using mormot compiler error

Which compiler version?
On which target?

Did you define the following conditional:

{.$define USEPACKAGES}
// define this if you compile the unit within a Delphi package
// - it will avoid error like "[DCC Error] E2201 Need imported data reference ($G)
//   to access 'VarCopyProc' from unit 'SynCommons'"
// - shall be set at the package options level, and left untouched by default 

Offline

#3 2017-03-28 07:48:07

Del
Member
Registered: 2017-03-24
Posts: 20

Re: Delphi package using mormot compiler error

Changed Conditional defines at project level to be as follows: USEPACKAGES;DEBUG and included {.$define USEPACKAGES} in .dpk file.

Compiling for 32 bit  WIndows target.

Using Delphi XE2 Update 4 Hotfix 1, also have IDE Fix pack XE2 5.95 installed.

Same error still occurring.

Offline

#4 2017-03-28 09:11:59

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

Re: Delphi package using mormot compiler error

And if you compile SynBidirSock not as a package?

Offline

#5 2017-03-28 10:22:50

Del
Member
Registered: 2017-03-24
Posts: 20

Re: Delphi package using mormot compiler error

If i include SynBidirSock in an app it compiles just fine.

My uses clause from a mormot perspective in package (that fails to compile) includes the following: SynCrtSock, SynCommons,   mORMot,  mORMotHttpClient

Offline

#6 2017-03-28 10:36:12

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

Re: Delphi package using mormot compiler error

Weird compiler bug?

My (biaised) opinion is that packages are not worth it, here.

Offline

#7 2017-03-28 11:34:00

Del
Member
Registered: 2017-03-24
Posts: 20

Re: Delphi package using mormot compiler error

I wanted to use packages to pursue a plugin based approach with specific implementations  relying on mormot.

Offline

#8 2017-03-28 20:48:25

Del
Member
Registered: 2017-03-24
Posts: 20

Re: Delphi package using mormot compiler error

I have figured it out. In Project Options -> Delphi Compiler -> Output - C/C++ menu the setting C/C++ Output File generation DEFAULTS to Generate all C++ Builder files (including package libs) even for a Delphi package....

Change this setting to Generate DCUs only, recompile...  resulting in 0 errors. Hope this helps someone else.

Last edited by Del (2017-03-28 20:48:53)

Offline

#9 2017-10-23 07:33:37

davor242
Member
Registered: 2017-10-23
Posts: 1

Re: Delphi package using mormot compiler error

Thank you Del. I am considering packages for the same exact reason as you mention.

Offline

#10 2019-06-11 04:50:17

missionhq
Member
From: Australia
Registered: 2019-06-11
Posts: 33

Re: Delphi package using mormot compiler error

Excellent Del, I have been trying to get mORMot to compile into a package with the same problems as yourself and this seems to have fixed things.

Offline

#11 2019-06-20 18:07:20

mattsbg
Member
Registered: 2017-05-23
Posts: 20

Re: Delphi package using mormot compiler error

Great work , thanks Del! Your report just saved me!

Offline

Board footer

Powered by FluxBB