RTT wrote:
> I think you could also use a WideString var parameter.

That would work which plain text, but it's slow..
I bet it's slower than one more copy of the result string.
Also using WideString leads to implicit string casts, 
without any warning in Delphi versions < 2009, which is
error-prone. 

-- 
Arno Garrels
  
 
> function ReadMessage(var msg:WideString):boolean; stdcall;
> var
>  Note: AnsiString;
> begin
>  EnterCriticalSection(CritSectn);
> 
>  if (NotesList.Count>  0) then
>  begin
>    msg := NotesList.Strings[0];
>    NotesList.Delete(0);
>    Result := true;
>  end
>  else
>    Result := false;
> 
>  LeaveCriticalSection(CritSectn);
> end;
> 
> 
> 
>> Thanks for the explanation and example, Arno, but I was 1 step ahead
>> of you in realising the mistake.
>> 
>> What I did (which appears to have worked as the errors are not being
>> reported now) is to simply move the "Note" variable into the global
>> scope. 
>> 
>> The DLL only gets called by one external process so I think it's a
>> reasonably safe approach... unless you know different. :-)
>> 
>> Regards, Adam
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to