Reputation: 1
I can't find information on how to register a component (a Package) in Embarcadero C++Builder 11 Alexandria Professional, to be used for both 32-bit and 64-bit projects.
Some informations that I found is in https://docwiki.embarcadero.com/RADStudio/Alexandria/en/64-bit_Windows_Application_Development.
I saw that for Delphi, you have to use the following syntax (which I found in a 2014 forum):
unit agnosticu;
interface
uses
System.Classes;
type
TAgnosticComponent = class(TComponent)
end;
[ComponentPlatforms(pidWin32)]
TWin32Component = class(TComponent)
end;
[ComponentPlatforms(pidWin64)]
TWin64Component = class(TComponent)
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Test', [TAgnosticComponent, TWin32Component, TWin64Component]);
end;
end.
In C++, I seem to have understood that I need to modify the following section of code:
namespace Mycomponent
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TMyComponent)};
RegisterComponents(L"MyCategory", classes, 0);
}
}
But regarding C++, I don't find any information on this.
I seem to understand that I should use the ComponentPlatformsAttribute
class and the pidWin32
and pidWin64
attributes, but I don't know how.
Or, with C++, is the only solution to modify the PLATFORMTARGETS
variable of the RC_DATA
resource?
Can anyone help me?
Upvotes: 0
Views: 456
Reputation: 1
Doing some tests I realized that it is not necessary to make any changes to the original code. The presence of the 64-bit Platform is enough to have the variable 'PLATFORMTARGETS' of the .BPL file (of the 32-bit version) set to the value 3, i.e. package compatible with both 32 and 64 bits (instead of the previous value 1 corresponding to only 32 bit).
Upvotes: 0