How can I have a Delphi XE2 project without unit aliasses? - delphi

I'd like to compile my XE2 project without unit aliasses but can't get it to work.
I tried the following:
<DCC_UnitAlias /> in the *.dproj
<DCC_UnitAlias>$(DCC_UnitAlias)</DCC_UnitAlias>
<DCC_UnitAlias>;$(DCC_UnitAlias)</DCC_UnitAlias>
No DCC_UnitAlias entry in the *.dproj
These either result in a compiler error
[DCC Fataler Fehler] F1030 Ungültige Compileranweisung: '-A;Generics.Collections=System.Generics.Collections;...
(which translates to something like [DCC Fatal error] F1030 Invalid compiler directive: '-A;Generics.Collections=System.Generics.Collections;...)
or the inclusion of some default aliasses:
-AGenerics.Collections=System.Generics.Collections;Generics.Defaults=System.Generics.Defaults;WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE
I know this is not a big issue but it somehow annoys me. :-)
FWIW: <DCC_UnitAlias /> works in D2007.

Under Delphi 10.1, it looks like the default unit aliases are added unconditionnally in the file $(BDS)\Bin\CodeGear.Common.Targets. I assume it is similar in XE2 but don't have it installed to check.
<UnitAliases>Generics.Collections=System.Generics.Collections;Generics.Defaults=System.Generics.Defaults;WinTypes=Winapi.Windows;WinProcs=Winapi.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE</UnitAliases>
<UnitAliases Condition="'$(DCC_UnitAlias)'!=''">$(DCC_UnitAlias)$(UnitAliases)</UnitAliases>
Removing the first UnitAliases tag should let you specify your defaults more accurately, on a per project basis. Beware of the "DO NOT MODIFY" warning at the top of this file, though.

Related

OmniThreadLibrary C++ builder Build issues

I'v been trying to get OmniThreadLibrary to run in builder, i've built it with all the c++ required files it builds ok but when i use it in an c++ builder app i get a bunch of error messages that look like the following
[bcc32 Error] DSiWin32.hpp(385): E2040 Declaration terminated incorrectly
one points at this line of code in the generated hpp file
static const System::Int8 CSIDL_ADMINTOOLS = System::Int8(0x30);
has anyone had this working in C++ builder or know the best way to resolve these issues
I'm using c++ builder settle and OmniThreadLibrary version 3.06
The Win32 API (and Delphi, for that matter) already declares CSIDL_ADMINTOOLS, Omni should not be declaring it at all. It should be using Delphi's Shlobj unit instead.
The Win32 API declares CSIDL_ADMINTOOLS using a #define statement:
#define CSIDL_ADMINTOOLS 0x0030
So the declaration in Omni's .hpp is getting modified by the C++ preprocessor to this:
static const System::Int8 0x0030 = System::Int8(0x30);
Thus the "Declaration terminated incorrectly" compiler error.
When Delphi code declares something that already exists in C++, it needs to be declared as either {$EXTERNALSYM} or {$NODECLARE} to avoid duplicate declarations, and then optionally use {$HPPEMIT} to output a relevant #include statement in a generated .hpp file. Delphi's units already do that for its Win32 declarations.
If Omni is not already doing that (and the error would suggest it is not) then it needs to be updated accordingly.

Delphi - Compiler Directives multi lines effects selected IDE error line

I'm wondering why if the compiler directives was typed on multi lines will effects the selected IDE error line.
For example:
{$SETPEFlAGS IMAGE_FILE_DEBUG_STRIPPED or
IMAGE_FILE_LINE_NUMS_STRIPPED or
IMAGE_FILE_LOCAL_SYMS_STRIPPED or
IMAGE_FILE_RELOCS_STRIPPED}
.....
procedure Foo();
begin
WriteLn('1');
WWriteLn('2');
WriteLn('3');
WriteLn('4');
WriteLn('5');
end;
IDE Error
[dcc32 Error] Crypter.dpr(29): E2003 Undeclared identifier: 'WWriteLn'
Inside the source code the selected line is WriteLn('5'); not WWriteLn('2');
But if the compiler directives was typed on this way (one line) :
{$SETPEFlAGS IMAGE_FILE_DEBUG_STRIPPED or IMAGE_FILE_LINE_NUMS_STRIPPED or IMAGE_FILE_LOCAL_SYMS_STRIPPED or IMAGE_FILE_RELOCS_STRIPPED}
Will fix the issue!.
If things are as you say, then this is a defect in the IDE. Report the issue as a bug to Quality Portal.
It's easy to work around the issue. Simply don't use multi-line directives. In this case you can extract the flag into a separate constant and refer to it in the directive.
const
PEFlags = IMAGE_FILE_DEBUG_STRIPPED or
IMAGE_FILE_LINE_NUMS_STRIPPED or
IMAGE_FILE_LOCAL_SYMS_STRIPPED or
IMAGE_FILE_RELOCS_STRIPPED;
{$SETPEFlAGS PEFlags}
The reason I hesitate in the first paragraph is that what you describe would also occur if the linefeeds were incorrect. If your linefeeds are not CR+LF then the IDE gets confused about line numbers. So, it's worth checking that your linefeeds are CR+LF. You could simply re-type the code and the linefeeds will be correct. Typically you get mixed up linefeeds when you paste from another source.

TIdHash128 Missing From Delphi XE3?

I am having a problem with Delphi XE3's Indy10. I cannot locate the class TIdHash128.
Indy's documentation states this should be found in IdHash.pas but this is not the case on my PC. Oddly enough the comment at the top of IdHash.pas reads "Rev 1.10 7/24/04 12:54:32 PM RLebeau Compiler fix for TIdHash128.HashValue()" despite having no definition for TIdHash128 in the file. I have also done a search through the source files but no TIdHash128 was found.
Is this supposed to be missing from XE3's version of Indy10?

What is dxGDIPlusClasses.dcu ? (Delphi)

A few month a go i wrote a program, now when i try to compile it i receive this error :
[DCC Fatal Error] PVCM.dpr(7): F1026
File not found: 'dxGDIPlusClasses.dcu'
I don't know which component I've used .
That is a Devexpress component for GDI+. Devexpress units invariably have cx or dx prefixes.
It sounds like a DevExpress component.
I just encountered this problem right now !!!
Go to the unit that generates the error. Look at the top of its source code.
You will find under Uses a unit called: dxGDIPlusClasses. Remove it and you should be fine.
Hint: Next time when you remove a set of components. You have to update the USES block in your previous projects or at least, give'em a double check.

How can I resolve this error in Delphi 2010: "[DCC Error] E2223 $DENYPACKAGEUNIT 'OleAuto' cannot be put into a package"?

I am converting a component package from Delphi 2007 to Delphi 2010.
When I do a full build, it compiles and begins to link. During linking, I get two messages:
[DCC Warning] MyPackage.dpk(235): W1033 Unit 'OleAuto' implicitly imported into package 'MyPackage'
[DCC Error] E2223 $DENYPACKAGEUNIT 'OleAuto' cannot be put into a package
What determines the units in $DENYPACKAGEUNIT? How should I resolve this error?
I found this inside the OleAuto.pas unit, which pretty much answers my question.
unit OleAuto deprecated;
{$DENYPACKAGEUNIT}
{ OleAuto cannot be used in a package DLL. To implement
an OLE automation server in a package, use the new
OLE automation support in comobj and comserv.
}
I found that someone had placed a call to MtsObj file, thats what seemed be to causing my issue.

Resources