Which Delphi version? It makes a difference if you are looking at string constants. They always have/start with a reference count of -1 and may be allocated in the read only code segment although in later versions (I thinks it starts in D5), the initialisation section for a unit copies the constant strings from the code segment into the read write data segment.
The reference count is not an integer but a 32bit unsigned integer ie Cardinal, so -1 is the maximum number of references - which usually means you are looking a string constant. If you have the source, sprinkling a few UnqiueString() calls around before pointer casts may fix your problems. Delphi certainly does Inc/Dec the reference count as required. Myles. -----Original Message----- From: Rohit Gupta [mailto:[EMAIL PROTECTED]] Sent: Thursday, 1 November 2001 1:53 p.m. To: Multiple recipients of list delphi Subject: [DUG]: LONG STRINGS I am trying to debug an decypher a third part library where the author has used ansistrings in strange ways. For example he is passing them to pointers and back. It seems to me that this may be defeating the reference counting... we are certainly getting strange errors where teh string is written into unusual places in memory. SO, I wrote a little app to examine the usage of ansistring. I have failed to find any sign of reference counting. It is simply not there. What am I missing. I am dumping the string and the 8 bytes before it (4 for reference counting and 4 for length), the way Borland docs say it is used). But the reference count is always -1. It makes no sense. Can someone enlighten me please. Regards Rohit ====================================================================== CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand PH (649) 489-2280 FX (649) 489-2290 email [EMAIL PROTECTED] or [EMAIL PROTECTED] ====================================================================== --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/