Re: [twsocket] DLL implementation advice (or example)...

2011-09-15 Thread Arno Garrels
Adam Burgoyne wrote: > I've now changed the > code to this which should solve the problem if I understood correctly: > > function ReadMessage: PAnsiChar; stdcall; > var > Note: AnsiString; > begin > EnterCriticalSection(CritSectn); > > if (NotesList.Count > 0) then > begin >Note := NotesL

Re: [twsocket] DLL implementation advice (or example)...

2011-09-15 Thread Adam Burgoyne
Hi, Wilfried - thanks for the explanation - I've been looking at the code for hours and just couldn't see the cause. I've now changed the code to this which should solve the problem if I understood correctly: function ReadMessage: PAnsiChar; stdcall; var Note: AnsiString; begin EnterCriticalS

Re: [twsocket] DLL implementation advice (or example)...

2011-09-15 Thread Wilfried Mestdagh
Hi Adam, > despite tearing out some hair and losing a Hopefully you have spare :) > Result := PAnsiChar(NotesList.Strings[0]); > NotesList.Delete(0); The problem is that you give a pointer to the return value of that function to something that not exists anymore after the functions exit

Re: [twsocket] DLL implementation advice (or example)...

2011-09-15 Thread Adam Burgoyne
Hi, All Ok - first the good news... despite tearing out some hair and losing a good few hours of sleep, my new TWSocket-based DLL with the worker thread is working brilliantly :-) Now for the bad news... I am getting some strange and intermittent "corruption" of function return values. I'm not s