delphi-units

Why are my units "compiled with a different version" of my own files?

I'm building a program that uses plugins. Unfortunately, the plugin framework's dynamic linking forces the RTL and VCL out of my project EXE and into the BPL versions, and they don't have debug info enabled. So I built a testing framework that links to my plugins statically so I can actually see what I'm doing while tracing through the...

Circular reference issue with Classes which use each other

I have the following two classes: TcmTPDataPanel = class(TcmTPBasePanel) Database: TnxDatabase; Session: TnxSession; private FDataConnector: TcmTPDataConnector; MyNxDataBase: TnxDatabase; MyNxSession: TnxSession; MyRefNxDataBase: TnxDatabase; protected procedure Disconnect; virtual; abstract; procedur...

How to use Unit files in Delphi

I'm just trying to get the hang of separate units to make my code more encapsulated. I'm trying to get the public/private declarations of my methods sorted out, so I can call them from other units that use testunit. In this example I want to make hellofromotherunit public, but stickletters private. unit testunit; interface uses ...

Defining types from other units in Delphi

Var A : Array [1..4] of Integer; B : Array [1..4] of Integer; Begin A := B; Won't work as loren-pechtel said here the problem is A and B for me are in different units. So, is there a way to define a type definition from a existing one in another class? ...

Does it make a difference if I clean up my uses clause if the removed units are still used in other units?

Personally I like it if my uses clauses are as small as possible, but in many applications the really big units (in terms of bloating the executable) like Forms or VirtualTrees are needed in at least another unit anyway. So: Does it make a difference if I clean my uses clauses even if in the end no unit is removed from the project? If s...

"Duplicate" units in Delphi by name, referenced by components, problem with compile

We are using several component packages by different vendors, and two of them both have a "regexp.pas" unit available inside their directory structure. Problem now is that regardless of the order we compile them in, one of them complains about the unit being compiled with the wrong version of various other units. Is there any way to ha...

How to run procedure from another unit?

Well this kind of n00b question but I still can't figure it out. I have unit main with procedure Discard() in it. Now I have another unit engine and I want to run from it procedure Discard() of unit main. I have main in uses section of engine.pas. I tried to call procedure with main.Discard() but no good. What am I doing wrong? ...

Accessing data stored in another unit Delphi

In Unit2 of my program i have the following code: TValue = Record NewValue, OldValue, SavedValue : Double; end; TData = Class(TObject) Public EconomicGrowth : TValue; Inflation : TValue; Unemployment : TValue; CurrentAccountPosition : TValue; AggregateSupply : TValue; AggregateDemand : TValue; ADGovernmentSpending ...