memorystream access violation ich werd bekloppt

Für Fragen zur Programmiersprache auf welcher Lazarus aufbaut
Antworten
laz847
Beiträge: 114
Registriert: Mi 18. Jun 2014, 16:39

memorystream access violation ich werd bekloppt

Beitrag von laz847 »

Sorry aber ich finde hier keinen Fehler, kann mir bitte jemand helfen???

Code: Alles auswählen

TCPx = class
   private
    FClient     : TLTcp;
    FRet        : String;
    FLog        : boolean;
    FError      : boolean;
    FCanSend    : boolean;
    FMStream    : TMemoryStream; 
................
function MT4_IPC_Init(const _dbg:Boolean=False):LongInt; stdcall;
begin
 TCPxHnd := TCPx.Create;
 TCPxHnd.FLog := _dbg;
 TCPxHnd.IpcLog('--1---------------------------------------------------------------------');
 TCPxHnd.FMStream.Create;
 TCPxHnd.IpcLog('--2---------------------------------------------------------------------');
 TCPxHnd.IpcLog('###>>> MT4_IPC_Init() > SizeOf(FMStream) '+IntToStr(SizeOf(TCPxHnd.FMStream)));
 TCPxHnd.IpcLog('###>>> MT4_IPC_Init() > Pos(FMStream) '+IntToStr(TCPxHnd.FMStream.Position));
 TCPxHnd.IpcLog('--3---------------------------------------------------------------------');   
 
Kommt nicht bis zur ---3--- vorher gibts eine AccessViolation???
--1---------------------------------------------------------------------
--2---------------------------------------------------------------------
###>>> MT4_IPC_Init() > SizeOf(FMStream) 4


Sorry das ich hier soviele Fragen stelle aber ich weiß echt langsam nicht mehr weiter :o

gocher
Beiträge: 298
Registriert: Di 23. Nov 2010, 23:41
OS, Lazarus, FPC: Ubuntu/Win, Lazarus trunk, FPC trunk
CPU-Target: 32Bit/64Bit
Wohnort: Geldern
Kontaktdaten:

Re: memorystream access violation ich werd bekloppt

Beitrag von gocher »

TCPxHnd.FMStream.Create; => TCPxHnd.FMStream := TMemoryStream.Create;
MfG Gocher
akt. Projekt: Webserver(HTTPS HTTP/2) mit integrierten CMS in Free Pascal - www.gocher.me

Benutzeravatar
m.fuchs
Lazarusforum e. V.
Beiträge: 2636
Registriert: Fr 22. Sep 2006, 19:32
OS, Lazarus, FPC: Winux (Lazarus 2.0.10, FPC 3.2.0)
CPU-Target: x86, x64, arm
Wohnort: Berlin
Kontaktdaten:

Re: memorystream access violation ich werd bekloppt

Beitrag von m.fuchs »

SizeOf? Das ist glaube ich nicht, was du möchtest. Nimm die Size-Eigenschaft vom Stream.
Zuletzt geändert von m.fuchs am Di 5. Aug 2014, 15:23, insgesamt 1-mal geändert.
Software, Bibliotheken, Vorträge und mehr: https://www.ypa-software.de

laz847
Beiträge: 114
Registriert: Mi 18. Jun 2014, 16:39

Re: memorystream access violation ich werd bekloppt

Beitrag von laz847 »

Ups ja sorry das komtm davon wenn man wild hin und her überlegt, da war vorher was anderes drin, diese Zeile hat aber nicht den fehler verursacht.

Egal, ich habe eine vollkommen andere und viel bessere Lösung gefunden, vielen lieben Dank für eure Hilfe!!!!

laz847
Beiträge: 114
Registriert: Mi 18. Jun 2014, 16:39

Re: memorystream access violation ich werd bekloppt

Beitrag von laz847 »

@gocher das wars ;)

Code: Alles auswählen

--1---------------------------------------------------------------------
--2---------------------------------------------------------------------
###>>> MT4_IPC_Init() > SizeOf(FMStream) 0
###>>> MT4_IPC_Init() > Pos(FMStream) 0
--3---------------------------------------------------------------------
###>>> IpcInit() > call > TCPx.Create > TCPxHnd > 71025960
###>>> MT4_IPC_Init() > Assigned(FMStream) -1


Hat mir jetzt doch keine Ruhe gelassen, musste ich noch fix probieren auch wenn jetzt eh rausfliegt ;)

Nochmals danke :D

Antworten