[Prev][Next][Index][Thread]
<c-string> and <byte-string> question
-
To: info-dylan@ai.mit.edu
-
Subject: <c-string> and <byte-string> question
-
From: Chris Double <chris@double.co.nz>
-
Date: Fri, 28 Sep 2001 04:15:02 -0400 (EDT)
-
Organization: None.
-
Sender: unknown@DOUBLE
-
User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.6
-
Xref: traf.lcs.mit.edu comp.lang.dylan:13693
If I use as(...) to get a <c-string> from a <byte-string>, do I get a
new <c-string> with freshly allocated memory, and data copied from
the <byte-string>, or do a get a <c-string> where the address of the
<c-string> points directly to the <byte-string> data.
In the fun-dev help it mentions that a <byte-string> can be used where
a <c-string> is expected and it points to the <byte-string>
memory. I'd like to know if this is what as(<c-string>, {a
<byte-string>}) results? If so, I take it I don't call destroy(...) on
the result of as(<c-string>, {a byte-string})?
I'm calling a C function that holds on to the pointer. I was doing
as(<c-string>, ...) but I'm getting spurious crashes. If as(...)
points inside the byte-string this would probably be the reason and
I'll need to change over to explicity create a new <c-string> and copy
the data into it. Is that right?
Chris.
--
http://www.double.co.nz/dylan