How to avoid the "A class named AClassName already exists" error when using DLLs in your applications
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?
Solution
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.
主程序和子程序 编译使用的bpl 个数和数量应一致
感谢:http://ntotl.blog.com.cn/archives/2007/2554664.shtml