Forward Decleration ?

  • 1
  • 2
  • Page 1 of 2
jomixl
Benutzer
Avatar
Gender:
Posts: 225
Registered: 02 / 2008
Subject:

Forward Decleration ?

 · 
Posted: 12.10.2015 - 13:24  ·  #1
Hallo zusammen,
ich versuche mich gerade mit der Forward-Decleration.
d.h.
ich suche einen Weg in Unit A eine Procedure aufzurufen die erst
später in UnitB deffiniert wird.

Bisher ist mir das mit der Forward-Decl. nicht gelungen.
Geht das überhaupt oder mach ich da was falsch?

Grüße Joachim
Harald_K
 
Avatar
 
Subject:

Re: Forward Decleration ?

 · 
Posted: 12.10.2015 - 17:43  ·  #2
also laut Handbuch geht forward nur innerhalb eines Programmes / einer Unit.

lies dir mal das Unit-Konzept durch im Handbuch, evztl. passt da ja was davon ....
sieht aber für mich auf den ersten Blick nicht so aus.

könntest du nicht einfach unita vor unitb importieren?
jomixl
Benutzer
Avatar
Gender:
Posts: 225
Registered: 02 / 2008
Subject:

Re: Forward Decleration ?

 · 
Posted: 13.10.2015 - 13:23  ·  #3
... das hab ich befürchtet,
muss mir jetzt anders behelfen ...

Danke Joachim
AVRfan
Benutzer
Avatar
Gender: n/a
Age: 68
Posts: 16
Registered: 11 / 2009
Subject:

Re: Forward Decleration ?

 · 
Posted: 13.10.2015 - 14:47  ·  #4
Hallo Jo,
in solchen Fällen macht man eine " Globals" Unit wo alles reinkommt was von mehreren Units verwendet werden sol.

Fan
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: Forward Decleration ?

 · 
Posted: 17.10.2015 - 12:19  ·  #5
Hi Jochim.

Do you mean you have need of 'cyclic' reference? i.e. UnitA uses unitB and UnitB uses UnitA?

If not all functions in the interface section are implicitly forward declared - i.e. you do not need to use the forward keyword.
jomixl
Benutzer
Avatar
Gender:
Posts: 225
Registered: 02 / 2008
Subject:

Re: Forward Decleration ?

 · 
Posted: 20.10.2015 - 12:24  ·  #6
Hi Merlin,
i nead som cyclic reference.
does it mean i have to use the forward decleration in both units or only in the first one in the row,
and ther i have to use it for all functions?

regards Joachim
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: Forward Decleration ?

 · 
Posted: 20.10.2015 - 13:50  ·  #7
Cyclic reference of units is not allowed at all. Cyclic references of functions within a unit is fine.

There are many ways of tackling the problem, and different solutions suit different circumstances. If you want to send your units via pm I will suggest how I would tackle your particular issues. All I would say is that forward declarations do not help here, but a solution is always possible.
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: Forward Decleration ?

 · 
Posted: 20.10.2015 - 14:30  ·  #8
@Jo,
cross-referencing of Units is not supported at this time.
A careful design of Units and their use order mostly avoids these problems.

@Merlin,
cross-referencing (cyclic reference) is on my todo list. But this will take some time.

rolf
  • 1
  • 2
  • Page 1 of 2
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   138   152 · Page-Gen-Time: 0.025844s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI