[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Memory Allocation Hooks
- From: skaller <skaller@...>
- Date: 14 Jan 2005 12:02:38 +1100
On Fri, 2005-01-14 at 06:09, Roberto Ierusalimschy wrote:
> The new system allows you to specify both the allocator function *and*
> a related user data. The allocator function always gets that user data
> when called:
>
> typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
This is the traditional workaround for brain dead languages
like C that do not provide closures.
FYI: my flxcc program is a wrapper generator that wraps
C functions so they can be called from my language Felix,
it actually recognises this feature automatically
in most cases (it would be confused by lua_Alloc because
it has two void *, ud and ptr, and can't guess which
one is the client data pointer)
The failure of the Win32 to provide this facility
indicates just how stupid Microsoft really are.
X Windows always provided it, there was no excuse
at all for this misdesign. The cost was absolutely
enormous -- whole systems (such as Borland's OWL
and MFC) existed just to work around it.
--
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850,
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net