Autor Beitrag
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Mo 20.02.06 13:12 
Sodele,
also ich versuch mal mein Problem zu beschreiben.
Und zwar ist es so, ich hab zwei units, in denen folgendes Deklariert ist:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
unit Main;

interface

uses {..} PMFrameUnit;

{..u.a. Deklaraiton der Hauptform}

type
TPMSession = record
{..}
Frame: TPMFrame //stammt von TFrame ab
end;
PPMSession = ^TPMSession;

{...}

implementation
...


Die Unit, in der TPMFrame deklariert ist:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
unit PMFrameUnit;

interface

uses {...}

type TPMFrame = class(TFrame)
  {...}
  public
    Session: PPMSession 
end;

implementation

uses main;
...



Sooo, wie manche vllcht schon an den hervorgehobenen Stellen aufgefallen ist, geht die Deklaration von TPMFrame.Session nicht. Hierzu müsste ich die Unit Main in die Uses-Klausel bei interface nehmen, was nicht geht, da main die Unit PMFrameUnit seinerseits schon in der oberen uses-Klausel hat.
Das Problem ist, dass ich die Deklaration von TPMSession nicht in eine andere Unit verschieben kann, da dieser Record verdammt (!) oft schon woanders benutzt wird, die Eigenschaft Frame ist aber dringend notwendig.
Auf der anderen Seite muss ich auch einem Frame sagen können, zu welcher PMSession er gehört, von daher muss auch hier die PMSession im Interface deklariert sein.

Irgendwie steht ich auf dem Schlauch...

...Grüßle alias5000

_________________
Programmers never die, they just GOSUB without RETURN
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 20.02.06 13:18 
Entweder beide Typen in eine Unit schmeißen,
Beide Typen in eine gemeinsame Unit auslagern, die von beiden dann eingebunden wird,
Eine der Typen-Deklarationen in den Implementations-Teil verschieben und auch den Bezug auf diese Unit nur im Implementations der anderen Unit,
Weiter ärgern, dass Zirkelbezüge nicht gehen.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
alias5000 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Mo 20.02.06 18:12 
user profile iconBenBE hat folgendes geschrieben:
Weiter ärgern, dass Zirkelbezüge nicht gehen.


Das ist gut, das mach ich :wink:
mal schaun, irgendeins nehm ich...

_________________
Programmers never die, they just GOSUB without RETURN
alias5000 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Mo 20.02.06 23:05 
Habs gelöst, anstatt eines Pointers PPMSession verwende ich einen einfachen Pointer in der Unit PMFrameUnit, sprich
ausblenden Delphi-Quelltext
1:
2:
3:
4:
...
public
  Session: Pointer
...

_________________
Programmers never die, they just GOSUB without RETURN