` Copying data from string to cstring without triggering non-thread safe RTL calls (Andy Ireland) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Clarion in general: Copying data from string to cstring without triggering non-thread safe RTL calls
2002-12-17 -- Andy Ireland
 
Newsgroups: comp.lang.clarion > But "SomeStr = SomeCStr" ends up with a: > > call dword [c55runx.dll:Cla$PushCString] //Pushes a cstring onto the > STRING stack > ... > call dword [c55runx.dll:Cla$PopCString] //Pops a cstring from the STRING > stack (converting it as it goes) > For the type conversion... Not safe! Replace with.... MoveMemory(address(SomeStr), address(SomeCStr), len) where len is strlen call from the VC++ RTL with null or not etc. The problem is worse for num to string etc but itoa should be used in this case. Also unsigned vars are processed using the stack therefore all values are long and not ulong etc. You only need the correct number of bytes to store it and not manipulate it as unsigned which accounts for 90% of usage i.e pointers etc. Regards Andy Plugware Solutions.com Ltd, taking the puzzle out of I.T Tel : +44 1249 813335 Fax : +44 1249 813462


Today is November 21, 2024, 3:58 am
This article has been viewed 35220 times.
Google search has resulted in 321 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: