Autor Beitrag
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: So 10.07.05 17:47 
ich hab da auch mal nen problem

folgendes funktioniert ohen probleme:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure blub;
var p: pointer;
label a;
begin
  a:
  asm
    mov p, offset a
  end;
end;


das aber nicht, wie kann ich das obige OHNE asssembler hinbekommen
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure bla;
var p: pointer;
label a;
begin
  a:
  p := @a;
end;


und wehe einer sagt mir das man labels nicht benutzen soll, in dem fall gehts nicht anders :)

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: So 10.07.05 18:05 
Wenn es mit Assembler geht, warum willst du dann unbedingt was anderes nehmen?

Zitat:
und wehe einer sagt mir das man labels nicht benutzen soll, in dem fall gehts nicht anders :)
Du machst mich neugierig! Eigentlich habe ich bisher immer alles ohne Spaghettis hinbekommen ;)

Ich würde übrigens mal behaupten, dass Delphi in ASM-Blocken weniger prüft, als in "normalem" Quellcode und sich deshalb weigert das Label als "Variable" zu sehen.

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
uall@ogc Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: So 10.07.05 18:13 
ein Label an sich ist ja nur eine adresse im speicher
das assembler zeugst sieht danna uch kompiliert net anders aus als

mov [variablenaddresse], speicherstelle

also:

mov [0x00401234], 0x00405678


ich will halt nicht immer assembler teile rumhaben
das hat was mit exception handling zu tun und das ich ne adresse angeben muss die ich halt nicht kenne, sondern der compiler diese erst festlegt

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
var p: pointer;

procedure exceptionhandler;
begin
  asm
    jmp p
  end;  
end;

procedure bla;
label blub;
begin
  // code
  asm
    mov p, offset blub
  end;

  // exception

  blub:
  // code
end;


und im exceptionhandler kann ich selbst net auf label zugreifen, bzw darf es aus anderen gründen net so das das label lokal bleiben muss, da ich noch berechnungen mit p mache

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
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: So 10.07.05 21:19 
Meine Tests mit dem Compiler (D7E) haben ergeben, dass Borland da wohl etwas geschlampthat. Wenn ich A als Label an einen Pointer zuweisen möchte, meint der Compiler ':' erwartet, aber (xy) gefunden. Wirst wohl um den ASM nicht drum rum kommen :(

_________________
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.