Autor Beitrag
longhugo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Dephi 7, WinXP, C++
BeitragVerfasst: So 07.08.05 11:38 
Hi, ich habe da ein komisches Phänomen:

Wenn ich aus meiner Mainform (TForm1) in folgende Procedure springe:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.ServerConnect;

var rcx: integer;
var f_users: PArrPChar;


begin

 // rcx := DCConnectServer(pchar(path), pchar(ip), port);
//  showmessage(inttostr(rcx));

  rcx := CLIENT.DCConnectServer('.','127.0.0.1', 25004);
  showmessage(inttostr(rcx));
  f_users := DCGetUsers();
  showmessage(f_users[0]);
  Free;

end;


DCConnectServer ist eine Funktion in einer C++ DLL. Aber das funzt soweit alles.
Er zeigt mir auch die richtigen Werte (zb. rcx =0, f_users[0] = "User1") aber sobald
ich aus der Procedure wieder zurück in das MainForm springe (per schrittweise debug)
dann haut er mir ne Access Violation bei 0x00000000 um die Ohren.

Habt Ihr ne Idee wo mein Denkfehler liegt? Muss ich irgendewelche Variablen "releasen"?
Achso...wenn ich den selben Code in der Mainform habe funktioniert alles...

Vielen Dank schonmal im voraus

LH

Moderiert von user profile iconMotzi: Code- durch Delphi-Tags ersetzt.
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 07.08.05 11:53 
das Free beszieht sich auf Form1.Free; -> was soll das bringen, bzw was willst du wirklich freigeben?

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
longhugo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Dephi 7, WinXP, C++
BeitragVerfasst: So 07.08.05 11:59 
user profile iconuall@ogc hat folgendes geschrieben:
das Free beszieht sich auf Form1.Free; -> was soll das bringen, bzw was willst du wirklich freigeben?


Das Free kannst Du streichen...da war nur n Versuch die Access Violation wegzubekommen (allerdings komplett sinnlos)
longhugo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Dephi 7, WinXP, C++
BeitragVerfasst: So 07.08.05 14:27 
Habe den Fehler gefunden: Beim debuggen hab ich mir die lokalen Variablen angesehen
und er hat die Meldung rausgegeben "variable rcx not accessible due to optimization"
Ich also Optimization ausgestellt und nu löppts.

aber warum das so ist weiß auch keiner oder?