John Dennis wrote:
>
> >Since the return value of GetProcAddress is context-independent, there
> >is no reason to require a currently bound context to call it.
>
> Although a supporter of context-independent pointers I disagree with this. I
> believe all the rules for having a bound context remain in force. Why? Because
> the context may have to register its extensions with the "API". Until the first
> context that exports the entry point in question has been bound it won't be
> known to the API. So a NULL or non-NULL pointer could be returned depending on
> what occured previously, if you don't bind YOUR context first.
So are you saying that before GetProcAddress can be called for a given extension,
a context which supports this extension must have been created and bound at some
time previous? This seems like a pretty onerous requirement to me, and kind of
invalidates the whole reason for context independent pointers in the first place.
By definition, the return value of GetProcAddress is completely independent
of any context. Therefore, it follows that no context specific information is
needed to generate the return value (including information about whether the
extension is supported or not!). So why would any context need to be bound
in order to call GetProcAddress? The implementation of GetProcAddress in this
case is fairly trivial:
- Search for the given extension string in a hash table
- if found
- return the dispatch stub associated with the given hash table entry.
- else
- create a new dispatch stub and hash table entry for the given extension.
- insert the table entry into the hash table.
- return the newly created stub
> > I have to stand up and count
> > myself among the supporters of context-independent function pointers.
> > For me, the compelling argument is that without context-independent
> > pointers it's very difficult to design libraries that are capable of
> > handling multiple contexts efficiently.
>
> I agree with Allen.
I agree with John's agreeing with Allen ;o).
Cheers!
--
Brett Johnson <[EMAIL PROTECTED]>
Workstation Systems Lab
Hewlett-Packard Company
"Politicians, like diapers, should be changed regularly,
and for the same reason."