Page 1 of 1

[Zeos 8.0] Packages for C++Builder

Posted: 05.03.2024, 15:25
by mac_srv
Hi All,

I'm testing an updated version of Zeos 8.0 (SVN version, revision 8099) Packages for C++Builder 12.0 Athens.

1. Build and Install

I'm able to compile and install the ZeosDBO components for Win32 platform.

For Win64 platform, there is a ilink64 error that might be related with C++Builder 12.0 itself:

Code: Select all

[ilink64 Error] Fatal: Import/Export error on symbol _ZTVN6System8Generics11Collections8TList__1IPN4Data2Db6TFieldEEE (flags:0x6004)
There is a thread about this in Facebook.


2. Test App

With the Win32 version, I was trying to test Zeos 8.0 with C++Builder 12.0 and the error is the same as in 2019 when I was testing 7.3.0:

viewtopic.php?f=50&t=77979#p130475

Something related with TZVariant and its

Code: Select all

vtBigDecimal: (VBigDecimal: TBCD);
declaration.


So, if the community see some relevance with ZeosLib and C++Builder, I might push this packages to my Github account and then share here.

I hope hear from you soon.

Regards,

Marcelo.

Re: [Zeos 8.0] Packages for C++Builder

Posted: 06.03.2024, 16:17
by marsupilami
Hello Marcelo,

since none of the currently active project members has experience in C++ Builder, the C++ Builder packages are less taken care of. So yes - I wioll be happy to integrate new packages.

Regarding the error on vtBigDecimal: What is the error message you get? For me it is strange, that this works for other types but not for the TBCD data type. But then - TBCD is a record type, I think and the other data types are primitive data types.

Best regards,

Jan

Re: [Zeos 8.0] Packages for C++Builder

Posted: 06.03.2024, 16:55
by mac_srv
Hi Jan,

Nice to interact with you again.

I'll upload my packages to Github an then reply to you here. I'll split then into 7.2.x and 8.x versions.

About the Test App example, using Win32, the error message is this:

Code: Select all

[bcc32 error] ZVariant.hpp (121): E2019 'operator TZVariant :: :: :: = (const struct &)' cannot be declared in an anonymous union
The error with ZVariant.pas is due the way the TZVariant type is translated to C++ (I've removed some code for simplicity):

Code: Select all

struct DECLSPEC_DRECORD TZVariant
{
public:
	TZVariantType VType;
	...
public:
	union
	{
		struct 
		{
			TZArray VArray;
		};
		...
		struct
		{
			Data::Fmtbcd::TBcd VBigDecimal; // <-- E2019 error here
		};
		...
		struct 
		{
			bool VBoolean;
		};		
	};
};
I think it depends the way TBCD is implemented.

On the other hand, this error can be fixed editing the TVariant.hpp manually. I know it is not recommend, but it puts ZeosDBO back on track for C++Builder:

Code: Select all

		struct MyBigDecimal
		{
			Data::Fmtbcd::TBcd VBigDecimal;
		};
I've done some research and I think we can't change the Pascal code in order put a name into these nested structs.

To my experience, this extra step might be plausible and accepted by other C++Builder users.

Regards,

Marcelo.

Re: [Zeos 8.0] Packages for C++Builder

Posted: 07.03.2024, 10:41
by marsupilami
Hello Marcelo,

I don't use c++ builder normally and seem to remember that setting up a working Zeos installation is quite a bit of a pain ;)

I would like to try something. Will the following code compile for you?

Code: Select all

typedef Data::Fmtbcd::TBcd TZBCD;

struct DECLSPEC_DRECORD TZVariant
{
public:
	System::UnicodeString VUnicodeString;
	System::RawByteString VRawByteString;
	Zclasses::IZInterface VInterface;
	
public:
	TZVariantType VType;
	union
	{
		struct 
		{
			TZArray VArray;
		};
		struct 
		{
			Zcompatibility::TZCharRec VCharRec;
		};
		struct 
		{
			void *VPointer;
		};
		struct 
		{
			System::TDateTimeBase VDateTime;
		};
		struct 
		{
			Zcompatibility::TZTimeStamp VTimeStamp;
		};
		struct 
		{
			Zcompatibility::TZTime VTime;
		};
		struct 
		{
			Zcompatibility::TZDate VDate;
		};
		struct 
		{
			GUID VGUID;
		};
		struct 
		{
			TZBCD VBigDecimal;
		};
		struct 
		{
			System::CurrencyBase VCurrency;
		};
		struct 
		{
			double VDouble;
		};
		struct 
		{
			unsigned __int64 VUInteger;
		};
		struct 
		{
			__int64 VInteger;
		};
		struct 
		{
			bool VBoolean;
		};
		
	};
};
I moved the reference to FmtBCD into a separate line and created a new type. Not sure if that will trick ilink to work as expected ;)

Could you please test this? If needed, I could also check this change into subversion so you can see what changes on the delphi side and regenerate the hpp files yourself.

Re: [Zeos 8.0] Packages for C++Builder

Posted: 07.03.2024, 14:05
by mac_srv
Hi Jan,

This change using a TZBCD also reaches the same error:

Code: Select all

                struct
		{
			TZBCD VBigDecimal;
		};  // <-- here

ZVariant.hpp(111): E2019 'operator TZVariant:: :: ::=(const struct &)' cannot be declared in an anonymous union
Indeed, C++Builder is a problematic cousin of Delphi.

My manuals, per package, are a small example of day-by-day thorns when using C++Builder. On the other hand, ZeosLib is great! :D

Thanks for your attention.

Marcelo.

Re: [Zeos 8.0] Packages for C++Builder

Posted: 13.03.2024, 14:13
by marsupilami
Hello Marcelo,

I am sorry for the late reply. I had a lot to do. We had the idea to move the VBigDecimal memer outside of the union. I hope this solves the ilink problem. Could you please check, if the following code compiles for you?

Code: Select all

struct DECLSPEC_DRECORD TZVariant
{
public:
	TZVariantType VType;
	System::UnicodeString VUnicodeString;
	System::RawByteString VRawByteString;
	Zclasses::IZInterface VInterface;
	Data::Fmtbcd::TBcd VBigDecimal;
	
public:
	union
	{
		struct 
		{
			TZArray VArray;
		};
		struct 
		{
			Zcompatibility::TZCharRec VCharRec;
		};
		struct 
		{
			void *VPointer;
		};
		struct 
		{
			System::TDateTimeBase VDateTime;
		};
		struct 
		{
			Zcompatibility::TZTimeStamp VTimeStamp;
		};
		struct 
		{
			Zcompatibility::TZTime VTime;
		};
		struct 
		{
			Zcompatibility::TZDate VDate;
		};
		struct 
		{
			GUID VGUID;
		};
		struct 
		{
			System::CurrencyBase VCurrency;
		};
		struct 
		{
			double VDouble;
		};
		struct 
		{
			unsigned __int64 VUInteger;
		};
		struct 
		{
			__int64 VInteger;
		};
		struct 
		{
			bool VBoolean;
		};
		
	};
};
This changes the layout of the TZVariant type, so most probably will not work in cases where TZVariant is used. But if it compiles for you I will submit the relevant change into the SVN repository, so the pas file will reflect the change.

Best regards,

Jan

Re: [Zeos 8.0] Packages for C++Builder

Posted: 13.03.2024, 20:36
by mac_srv
Hi Jan,

No rush about this subject.

This change compiles without error modifying the "ZVariant.hpp" file. Nice!

On the other hand, there are a similar declaration in "ZDatasetParam.pas" for "TZParamValue" that emits a header like this (omitted some parts):

Code: Select all

struct DECLSPEC_DRECORD TZParamValue
{
	
private:
	struct DECLSPEC_DRECORD _TZParamValue__1
	{
	public:
		void *VArray;
		void *VIsNullArray;
	};	
public:
	union
	{
		...
		struct 
		{
			Data::Fmtbcd::TBcd pvBCD;
		}; // <- Error here                                                    
		...		
	};
};
The error is the same as before, about the TBCD type:

Code: Select all

[bcc32 Error] ZDatasetParam.hpp(95): E2019 'operator TZParamValue:: :: ::=(const struct &)' cannot be declared in an anonymous union
I've forgot to mention the problem with "ZDatasetParam.pas". The error is similar, but "TZParamValue" and "TZVariant" have different type declaration.

Maybe this strategy of remove the TBCB outside "case Integer of " might help.

Thank you for all your help.

Marcelo.

Re: [Zeos 8.0] Packages for C++Builder

Posted: 15.03.2024, 16:57
by mac_srv
Hi Jan,

Just to record research on the error with ilink64.

C++Builder Developer's Facebook group post.

It actually turned out to be a problem with C++Builder 12.0:

Embarcadero's Quality Portal

It seems that C++Builder 12.0 has a bug when compiling Delphi code with Generics. I'm following this problem, perhaps we have a solution with the next 12.1 release and the new C++Builder Win64 compiler toolchain.

Regards,

Marcelo.

Re: [Zeos 8.0] Packages for C++Builder

Posted: 17.03.2024, 16:46
by marsupilami
Maybe we shoud have a define, so that TBCD is outside of the union only for Delphi 12.0?

Re: [Zeos 8.0] Packages for C++Builder

Posted: 18.03.2024, 11:31
by mac_srv
Hi Jan,

The problem with TBCD I have reproduced it since C++Builder 10.2 when compiling ZeosDBO 7.3/8.0 versions. Also, I can try to reproduce it with C++Builder XE2 and RAD 2009 in order to have a better picture.

On the other hand, this problem with ilink64 is new and almost for sure just happens with C++Builder 12.0 and maybe 11.x.

Marcelo.

Re: [Zeos 8.0] Packages for C++Builder

Posted: 25.03.2024, 12:18
by marsupilami
Hello Marecelo,

could you please check what happens with the current trunk version fo Zeos? (Not Zeos 8.0 yet.) I added a define and ssmall changes for this problem there. If it works we can merge it into zeos 8.0.

Best regards,

Jan

Re: [Zeos 8.0] Packages for C++Builder

Posted: 05.04.2024, 11:41
by mac_srv
Hi Jan,

Sorry about the delay, I was finishing another project.

I've tested SVN trunk revision 8118 and success!

No more bcc32 error with TZVariant (ZVariant.pas) and TZParamValue (ZDatasetParam.pas). The respective auto generated .hpp files have the Data::Fmtbcd::TBcd type declared outside the struct's union sections.

Just a note: the ilink64 error I'll test againg with CBuilder 12.1 and the new C++Builder Win64 compiler toolchain. I'll report it here soon.

Best,

Marcelo.

Re: [Zeos 8.0] Packages for C++Builder

Posted: 16.05.2024, 13:12
by mac_srv
Hi Jan,

Just an update: the ilink64 error persists with CBuilder 12.1 and the new C++Builder Win64 compiler toolchain.

Important: this is a CBuilder problem, not Zeo's.

I've tested it against CBuilder 12.1`s release (RAD Studio, Delphi, C++Builder 12.1 Web Install) and Patch #1 (RAD Studio 12.1 Patch 1).

I'll keep following future versions and report any improvement here.

Regards,

Marcelo.

Re: [Zeos 8.0] Packages for C++Builder

Posted: 16.05.2024, 16:55
by marsupilami
Hello Marcelo,

I added the VER370 defie to the list of the problematic release too. I assume that is what Emarcadero uses for Delphi 12.1?

Best regards,

Jan