Mail Archives: djgpp/1997/03/14/10:13:10
Alaric B. Williams (alaric AT abwillms DOT demon DOT co DOT uk) writes:
> On 10 Mar 1997 06:46:24 GMT, ao950 AT FreeNet DOT Carleton DOT CA (Paul
> Derbyshire) wrote:
>
>>Two questions:
>
>>* This seems to say that something like this won't work:
>
>> char *the_ptr;
>> the_ptr=malloc(the_size);
>> _go32_lock_data_memory(the_ptr,size); (syntax? not sure)
>
>> because later the data may find itself moved somewhere (despite being
>> locked?) while the locked memory stays put?
>
> No. The addresses of things can't change behind the scenes - a
> restriction of the C language due to pointer casting problems - so
> once you lock something, it's locked; you lock the *virtual* address
> range, not the physical address, which is subject to change. Anyway,
> the above code /is/ wrong - you must lock the pointer AND what it
> points to!
Oops, I know this, I forgot since I was typing a usenet posting and not
writing real useful code. :)
char *the_ptr;
the_ptr=malloc(the_size);
_go32_lock_data_memory(the_ptr,size); (syntax? not sure)
_go32_lock_data_memory(&the_ptr,sizeof(char *));
--
.*. Where feelings are concerned, answers are rarely simple [GeneDeWeese]
-() < When I go to the theater, I always go straight to the "bag and mix"
`*' bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh
- Raw text -