[Mono-devel-list] reading char * from extern function
Marcus
mathpup at mylinuxisp.com
Thu May 22 20:56:17 EDT 2003
Having the runtime automatically free the C-string seems very dangerous. Some
functions might return a pointer to a string but also store the pointer
elsewhere expecting that the string will remain allocated. Even worse, it's
possible for a function to return a pointer to a statically-allocated string.
(What happens in this case when the runtime tries to free the string?)
There is also a question about whether it is legal to mix malloc/free with the
glib equivalents. (Last I asked, I could not get a definite answer.)
tring was allocated using malloc, using some glib allocation function, or
On Thursday 22 May 2003 3:27 am, dietmar wrote:
> On Thu, 2003-05-22 at 09:31, md at mt.web.id wrote:
> > situation:
> > I have a C library. One of it's function is:
> >
> > char * some_func(int param, const char * param2) {
> > the next question is: should I free() the retval? if yes, how to do
> > that?
> I guess the runtime should free the string for you, but we don't do that
> currently. Somebody should test how MS handles this.
More information about the Mono-devel-list
mailing list