On Oct 18, 2011, at 3:36 PM, Matthew Flatt wrote:

> At Tue, 18 Oct 2011 15:27:28 -0700, John Clements wrote:
>> It looks like there's a problem with the ffi implementation of (malloc ... 
>> 'raw) in Windows.  In particular, if I call 'free()' in a C extension on a 
>> block of memory that was allocated with (malloc ... 'raw), I get the Windows 
>> equivalent of a core dump, with an exception code that indicates "heap 
>> corruption".
> 
> The problem is that Racket and the extension are linked to different C
> libraries, so you can use `malloc' from Racket only with `free' from
> Racket.
> 
> The options for getting everything to use the same C library are not
> pleasant. See
> 
> http://kobyk.wordpress.com/2007/07/20/dynamically-linking-with-msvcrtdll-using-visual-c-2005/
> 
> for a taste of the problem.
> 

Two small follow-ups.

1) This is only a problem under Windows, right?

2) It looks to me like there's an easy workaround in my case, which is simply 
to put the 'malloc' on the C side in a one-line stub function. Right?

Many thanks for the prompt response.

John

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Reply via email to