This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: malloc and free mixing in VC++ and cygwin


Maybe. :)

More precisly, can `malloc' be used to allocate memory in cygwin
and `free' be used in VC to free the cygwin-allocated memory?
No -- they use different memory schemes.

However, that doesn't mean that you can't have one environment
allocate memory, and have the other free it -- you just can't
use the C runtime functions.

The Win32 functions CoTaskMemAlloc() and CoTaskMemFree() can
be used to allocate/free memory between 2 otherwise incompatible
memory schemes.  I suspect that most of the other Win32 memory
functions (GlobalAlloc/GlobalFree, etc.) could also be used
to do this as well.

hth
- Jon

-----Original Message-----
From: Dominique MICOLLET <miko@thetis.u-bourgogne.fr>
To: cygwin <cygwin@sourceware.cygnus.com>
Date: Thursday, April 29, 1999 4:34 AM
Subject: malloc and free mixing in VC++ and cygwin


>Hello,
>
>I browse both FAQ, Users Manual and mailing list archive but was unable to
>find the answer to the following question :
>
>- is it possible to malloc a buffer within a cygwin procedure and free this
>buffer within a VC++ procedure ?
>- and inversely ?
>
>I suspect no, but I wish a confirmation.
>
>      Cordialement
>
>Dominique MICOLLET       Email   : Dominique.Micollet@u-bourgogne.fr
>Laboratoire LE2I    Universite de Bourgogne
>9, Avenue Alain SAVARY  BP 400        Tel     : +33/(0)3-80-39-59-27
>21011 DIJON CEDEX       FRANCE        Tfx     : +33/(0)3-80-39-68-69


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com