guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: proposal: scm_string2str() and scm_symbol2str()


From: stefan
Subject: Re: proposal: scm_string2str() and scm_symbol2str()
Date: Wed, 21 Nov 2001 22:10:27 +0100 (CET)

On Wed, 21 Nov 2001, Dirk Herrmann wrote:

> > I must admit that I've never seen this on a Unix platform.  But
> > unfortunately it is common use on M$-Windows platforms to replace a
> > written "free()" to different kinds of heap allocation free()'s depending
> > on the "memory model".  Is this reason enough to have such functions?
> 
> I still don't get it.  How can those functions be named 'free' and these
> people not getting conflicts with the standard library's free?  Don't they
> use a different name for their 'personal free'?  I mean, if we allocate
> our memory with 'malloc', then there has to be some appropriate 'free'
> linked into the application, doesn't it?  Since we don't use a different
> name than 'free' for the memory that guile frees, how can people get a
> different one?

1. There are different memory allocation API's.
2. Thereby "free()" and "malloc()" can have different meanings.
3. This is *not* a problem inside a monolithic executable, because
   "free()" and "malloc()" match each other.
4. This is a *real* problem if you create a DLL (namely libguile.dll)
   using *one* allocation API and create an executable linked against
   this DLL and using *another* allocation API.
5. Therefor all this is not a problem inside libguile.
6. It is just a problem when you use libguile.
7. The problem can be avoided if you supply a "free()" and "malloc()" 
   from inside libguile as I proposed.


Finally: For a clean memory interface of a client program to libguile 
we use the following functions from libguile:

 * scm_c_malloc  -- should be used to allocate memory returned by some 
                    of the SCM to C converter functions in libguile if the
                    client program does not supply memory
 * scm_c_free    -- must be used by the client program to free the memory
                    returned by the SCM to C converter functions in 
                    libguile if the client program did not supply a buffer
 * scm_c_realloc -- to be complete, do not know a real purpose yet


I start doubting my English is any good for.  Did you get the idea this
time?

> Sorry, but I feel more and more that this support for M$ platforms
> influences our code base in a bad way.

So why this?

Cheers,
        address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]