delphi-2010

How can I set the $RTTI directive for the entire project?

本秂侑毒 提交于 2019-11-30 15:55:13
问题 I'm working on migrating an old project from Delphi 2007 to Delphi 2010. One thing I've found is that the resulting executable has more than doubled in size, and the original was already quite big. (Over 50 MB.) I suspect that a lot of it has to do with extended RTTI. Since the project predates Delphi 2010, it doesn't use extended RTTI anywhere, and I'd like to be conservative about including it. Is there any way to use the Project Options dialog to globally set {$RTTI EXPLICIT METHODS([])

Generic method returning generic interface in Delphi 2010

社会主义新天地 提交于 2019-11-30 13:58:09
Given the code below, wich is a very trimmed down version of the actual code, I get the following error: [DCC Error] Unit3.pas(31): E2010 Incompatible types: 'IXList<Unit3.TXList<T>.FindAll.S>' and 'TXList<Unit3.TXList<T>.FindAll.S>' In the FindAll<S> function. I can't really see why since there is no problem with the previous very similar function. Can anyone shed some light on it? Is it me or is it a bug in the compiler? unit Unit3; interface uses Generics.Collections; type IXList<T> = interface end; TXList<T: class> = class(TList<T>, IXList<T>) protected FRefCount: Integer; function

Rtti accessing fields and properties in complex data structures

随声附和 提交于 2019-11-30 12:20:10
问题 As already discussed in Rtti data manipulation and consistency in Delphi 2010 a consistency between the original data and rtti values can be reached by accessing members by using a pair of TRttiField and an instance pointer. This would be very easy in case of a simple class with only basic member types (like e.g. integers or strings). But what if we have structured field types? Here is an example: TIntArray = array [0..1] of Integer; TPointArray = array [0..1] of Point; TExampleClass = class

How to create an instance of object with RTTI in Delphi 2010?

。_饼干妹妹 提交于 2019-11-30 12:11:38
问题 As we all known, when we call a constructor of a class like this: instance := TSomeClass.Create; The Delphi compiler actually do the following things: Call the static NewInstance method to allocate memory and initialize the memory layout. Call the constructor method to perform the initialization of the class Call the AfterConstruction method It's simple and easy to understand. but I'm not very sure how the compiler handle exceptions in the second and the third step. It seems there are no

Delphi XE3 EXE file size 25 times larger than Dephi 7

…衆ロ難τιáo~ 提交于 2019-11-30 11:49:43
问题 As a test I decided to create a simple "Hello world" app in Delphi using Delphi 4, 5, 6, 7, 2005, 2010 and XE3. The app is nothing more than a TForm, a TButton with an OnClick event that calls ShowMessage('Hello world'). Below are the results of each final EXE with debugging turned off: Can someone explain why the XE3 version is 26 times larger than the average of the previous versions of Delphi? Here are my project settings for XE3: 回答1: You may have done a only a compile after changing to

How to get all of the supported file formats from Graphics unit?

南楼画角 提交于 2019-11-30 06:55:49
问题 When any TGraphic descendant registering its own graphic file format with a class procedure TPicture.RegisterFileFormat(), they're all stored in Graphics.FileFormats global variable. Too bad that FileFormats variable is not in the "interface" section of "Graphics.pas", so I can't access it. I need to read this variable to implement a special filter for my file-list control. Can I get that list without manual fixing the Graphics.pas's source code? 回答1: You are working with a file-list control,

Delphi TPath.GetTempPath result is cropped

本小妞迷上赌 提交于 2019-11-30 03:13:42
问题 I am using Delphi 2010 and my program wants to get the system's temp path. I am using TPath.GetTempPath and everything is working fine... at least for me and my coworkers. But on some customer machines this method returns a cropped path which is (of course) not existing. I found out that the problem seems to be the result from underlying call to GetLongPathName(). The complete code looks like this: [...] var TmpDir : String; Len : Integer; begin [... Call to GetTempPath succeeds and we have a

Why does line count change so much from D2007 to D2010?

烂漫一生 提交于 2019-11-30 03:12:43
问题 Our app at work is a huge project with over 3000 units, weighing in about 3.5 million lines of code. ...or at least it was when we were compiling it under D2007. We recently updated to D2010, and now if we run a full build, the line count finally stops at about 4.9 million. Same DPR, same code base, same everything, but the compiler's somehow running over about 40% more lines of code in the build cycle and nobody here knows why. Just to make things more confusing, after building, we can go to

Delphi: Store data in somekind of structure

萝らか妹 提交于 2019-11-30 02:32:21
For a simulation program I'm working in Delphi 2010. The simulation isn't a problem but I need to use large collection of data which gives a problem. The data is available in excel sheets, so there is no need to edit this data in Delphi, but collecting this data from the excel sheets takes around 10min. This isn't a problem as long as you don't need to collect the data every time the program runs. So I made a program which collects all the data makes it visible, not problems here,and then store it. However I can't store it to a "Delphi format" , without losing the structure, so it can be

Rtti accessing fields and properties in complex data structures

扶醉桌前 提交于 2019-11-30 02:28:14
As already discussed in Rtti data manipulation and consistency in Delphi 2010 a consistency between the original data and rtti values can be reached by accessing members by using a pair of TRttiField and an instance pointer. This would be very easy in case of a simple class with only basic member types (like e.g. integers or strings). But what if we have structured field types? Here is an example: TIntArray = array [0..1] of Integer; TPointArray = array [0..1] of Point; TExampleClass = class private FPoint : TPoint; FAnotherClass : TAnotherClass; FIntArray : TIntArray; FPointArray :