3

I have a Delphi component which I want to install and have it available at the component palette in Delphi but not in C++ Builder. In BDS/RAD 2006 and above I can either have it installed for both personalities or none.

I need to do so because this component uses 3rd party libraries that doesn't support C++ Builder.

I have looked at jedi.inc mentioned here but I'm not able to find the combination to be able to register the component in Delphi personalities only. The component should also work for older Delphi versions: D5, D6 and D7; but not for BCB5 and BCB6. Is this possible?

BTW: Component is written in Delphi. C++ Builder shares same packages as Delphi.

Thanks in advance.

1 Answer 1

5

the BCB define is only set when Delphi is compiling with support for C++Builder (using the -J switches) You can use code like this to detect that someone is trying to build your package with C++ support and issue an error

{$IFDEF BCB}
{$Message Error 'This component is not usable in C++Builder'}
{$ENDIF BCB}
10
  • Thanks David. the problem with this is that this component is part of a package which contains other components which should work in C++ Builder. Only this component should not be registered. Commented Apr 14, 2010 at 8:51
  • My experience is with getting people to /enable/ C++ Support, so I've not tried going the other way before… you could try these directives: {$J OFF} {$OBJEXPORTALL OFF}
    – David Dean
    Commented Apr 14, 2010 at 16:16
  • Hello David, thanks for your answer again and sorry for my delayed reply. I haven't been able to get this working though. Probably it's because of Remy Lebeau said here: forums.embarcadero.com/…. Commented Apr 26, 2010 at 8:43
  • I understand why he said what he did, and he is correct that the code is there and should theoretically be accessible. However, whether or not the code is accessible has little relevance to whether a component will register correctly in the IDE. My experience is that it is possible to have Delphi-only components because I've had to help people who could only see their components in Delphi, but wanted to see them in both Delphi and C++.
    – David Dean
    Commented Apr 26, 2010 at 15:22
  • Thanks David. I'm using code below. TComponent3 needs to be registered in Delphi only. What's wrong with that? RegisterComponents(MyPaletteMessage,[ TComponent1, TComponent2 {$IFNDEF CLX} {$IFDEF BCB} {$J OFF} {$OBJEXPORTALL OFF} ,TComponent3 {$ENDIF} {$ENDIF} ]); Commented Apr 27, 2010 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.