harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr <g...@pobox.com>
Subject Re: [classlib] mem
Date Mon, 26 Jun 2006 23:41:33 GMT


Tim Ellison wrote:
> Geir Magnusson Jr wrote:
>> Tim Ellison wrote:
>>> Geir Magnusson Jr wrote:
>>>> Except...
>>>>
>>>> 1) They aren't as Jimmy suggests, at least the one's I'm looking at.
>>>>
>>>> 2) the implementation in hymem.c just calls malloc()
>>>>
>>>> I'm confused.
>>> Hopefully you are no longer confused after Oliver's explanation.
>> Yes, although I am still confused why you would want to do this.
> 
> (I hope I see what you are confused about, but correct me if I'm wrong)
> 
>> We have an implementation in hymem.c :
>>
>>   hymem_alloc_memory( HyPortLib *, int )
> 
> That is the actual function that allocates memory, and in this case it
> is platform specific, eventually calling HeapAlloc on Windows and malloc
> on Linux.
> 
> This function is (deliberately) not exported from the hyprt.dll so you
> cannot call it directly.  You have to call it via the function pointer
> table ...

That's the missing element - it's not exported.

[snip obvious stuff]

> 
> Of course, you can reference that member directly if you so choose, and
> as written elsewhere if you are dealing with multiple tables the
> syntactic sugar doesn't help and you must reference it in full.
> 

When would you have multiple tables?

[snip]

> 
> I guess that the confusion is caused by the HyPortLib struct containing
> a member called 'mem_allocate_memory' that has the address of a function
> called 'hymem_allocate_memory'?
> 

really it was having a macro and a function named the same, differing
only by a number of arguments where the macro expanded out to what has
the potential of being something very different than the function
because of the function table.  It wasn't obvious that the function
wasn't exported (of course).

thanks

geir




---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message