We have a lot of Delphi Projects, when I build them before, I didn't see any error. But recently I see the following 开发者_Go百科error when I build one of those projects.
D:\Delphi Projects\MySetting.pas Fatal: Could not compile used unit 'mscorlib_TLB.pas'
At first I thought some background process is using this mscorlib_TLB.pas, then I restart my computer and build it again, it still fails and gives the same error above. What is this mscorlib_TLB.pas error?
Thanks!
You have imported a COM object that is COM Callable Wrapper (CCW) around a managed (.net) object. The imported type _TLB.pas
file will (sometimes needlessly) have a reference to mscorlib_TLB
in its uses
clause.
Delphi's type-library importer is buggy, and there are syntax errors in the auto-generated TLB pas file.
Try removing references to mscorlib_TLB
in whatever unit is using it.
If the unit actually depends on something in mscorelib
, then you'll have to manually fix the syntax errors in the 400kB pas file.
If you really need to use the library, you can import it using the Component::Import Component tool.
I found mscorlib_TLB
alongside a COM wrapper that I built in C# a few years ago, MyComWrapper
. When I copied MyComWrapper_TLB
to another workstation, it was also necessary to copy mscorlib_TLB
since it included type definitions required by MyComWrapper_TLB
.
A re-import of the related tlb should regenerate mscorlib_TLB.pas
if it can't be found. It appears I reimported the tlb on Oct 4, 2017.
Here's the prologue describing the unit:
unit mscorlib_TLB;
// ************************************************************************ //
// WARNING
// -------
// The types declared in this file were generated from data read from a
// Type Library. If this type library is explicitly or indirectly (via
// another type library referring to this type library) re-imported, or the
// 'Refresh' command of the Type Library Editor activated while editing the
// Type Library, the contents of this file will be regenerated and all
// manual modifications will be lost.
// ************************************************************************ //
// $Rev: 52393 $
// File generated on 10/4/2017 11:15:21 PM from Type Library described below.
// ************************************************************************ //
// Type Lib: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.tlb (2)
// LIBID: {BED7F4EA-1A96-11D2-8F08-00A0C9A6186D}
// LCID: 0
// Helpfile:
// HelpString: mscorlib.dll
// DepndLst:
// (1) v2.0 stdole, (C:\Windows\SysWow64\stdole2.tlb)
// Parent TypeLibrary:
// (0) v1.0 MyComWrapper, (C:\source\my-client\client-project\MyComWrapper\bin\x86\Release\MyComWrapper.tlb)
精彩评论