We are trying to split our monolithic exe into a combination of exe and several packages. So far, we have one package that we are trying to use, and when starting the EXE Codeguard, the following error is displayed at startup:
CG Error
Two different CRTLDLLs are loaded. CG might report false errors
(C: \ Windows \ system32 \ CC32100MT.DLL)
(D: \ Projects \ Foo \ Bar.bpl)
Ok
I read this as two different downloadable runtime libraries: one, correct (CC32100MT.dll), one incorrect, which is the package that we are trying to use.
Continuing to run the program shows odd errors, especially throwing between classes or passing a pointer to a class as a parameter in a method that crosses the EXE / DLL boundary. Edit: Now this is allowed and unrelated. The program works correctly, but the Codeguard warning is still a concern.
How do we solve this?
Additional Information
We looked at as many things as we (the developer working on this and me) can collectively think:
Each project is created using runtime packages. The list of EXE hosts lists a string in the package list.
Each project is configured to compile with dynamic RTL. However, changing this does not solve the problem.
The package is linked to the EXE through its BPI file, but the link through the LIB also does not matter.
EXE and BPL are compiled with the same project settings, where the same parameters exist for both types of projects. We still think :)
There is only one copy of BPL and BPI in the system: it definitely connects to the correct one.
Examining EXE and BPL using Depends and TDump shows that they both use C:\Windows\system32\CC32100MT.DLL . They should both use the same RTL.
Creating a new project (a simple application of VCL forms) and binding to the BPL (through its BPI) works fine. Something in the process of adding all the files and LIBs that make our EXE contain the code that he needs to change this, but we could not figure out that.
LIBs either correspond to the DLLs we use (the flat C interface, as a rule, looks as if they were built using MSVC), or are simple projects with a large number of linked files compiled into lib for the purpose of binding the EXE - they roughly correspond to the areas of the program that we want to divide into BPL, by the way. Apparently, there are no design options for LIB projects that affect RTL binding if we have not missed them.
I exhaustively hunted through Depends and looked at all RTL and CC32 *. DLL files are EXE and each link to a DLL. All of them are identical: rtl140.bpl and CC32100MT.DLL. Full paths show that they are the same files. Everything should use the same runtime library.
Edit: The final EXE is complex, built with multiple libraries, multiple DLLs, etc. All this when building with C ++ Builder is built with the current version. Is there anything possible in one of these DLLs or LIBs that might cause the problem? I don’t know enough about how RTL is connected to be sure where to look ... my (naive?) Assumption is that the linker is usually linked in one set of RTL functions, but this certainly does not seem to happen. .. and I don’t know how everything changes when using packages. Is it possible that this error always existed, and Codeguard did not mark it before, because we did not use something dynamic, like a package?
Perhaps another question: why does the package have its own RTL anyway, or what would it count as the “RTL DLL” for Codeguard?
We are at a dead end. Absolutely dumb. We had other problems using BPL (they seem surprisingly complex, especially using C ++), but they managed to solve them all. We were not lucky at all, and we really appreciate any ideas :)
We use C ++ Builder 2010 (as part of RAD Studio in fact, but with a little Delphi code, except for the components).
Edit:. Generosity will begin. I would really like to solve it!
Edit 2: Thanks to David Dean for his help (marked as noted below). Through e-mail, he indicated that this question was reproduced in a simple test case by someone else, and was registered in Embarcadero QC as report 86335. There is currently no fix, but the warning does not indicate a genuine problem (i.e. This, probably a false mistake, and although it’s a pity that you need to click on the dialog at startup, I hope there’s nothing wrong with that.)