Ticket A1994
Visible to All Users

How to avoid the "A class named AClassName already exists" error when using DLLs in your applications

created 20 years ago

Description:
I'm working on a project which uses the ExpressQuantumGrid and ExpressBars. Some of the application's modules are built as DLLs. When I try to load a particular DLL an error occurs:

"A class named TdxStatusBarContainerControl already exists".

What am I doing wrong?

Answer:
There is a strict rule that you should follow when compiling a DLL: You must compile both the main module and the DLLs with those runtime packages, which contain the classes used in both** modules. In your case, you should include the ExpressQuantumGrid's and the ExpressBars' (the TdxStatusBarContainerControl component is a part of the ExpressBars) runtime packages to the list of runtime packages when compiling your application and DLLs. This way, everything will work fine.
NOTE: This approach requires you to deploy the corresponding runtime packages with your application.
See also:
How to properly use CX Shell editors in a DLL
Why is it impossible to close an application which uses the ExpressNavBar hosted in a DLL?
How to determine which runtime packages to deploy for a VCL component

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.