Memory Access problems (possibly)...

David Anderson deandrsn at uiuc.edu
Tue May 26 00:56:17 UTC 1998


>> >c) You might have forgotten to pass on the pointer to the interface
>> >   itself. This is in principle equal to b) since there is just one
>> >   parameter wrong which is quite a significant pointer.
>>
>>
>> Unfortunatly, the function I am trying to call is simply AddRef of the
>> IUnknown interface, and thus I am passing no arguments at all.  Any other
>> ideas?
>
>That's point c) since COM uses C++ calls which always have the pointer to
>the instance (in your case the interface) as argument. Taken from the
>Win32 SDK "unknwn.h" file the C style declaration looks like:
>
>  ULONG AddRef(IUnknown * This);

Of course.   Thanks.

>You should also keep in mind that all COM functions use C++ virtual
>methods meaning that the actual function pointer is obtained by a
>lookup in the interface which is basically an array with all sorts of
>function pointers. Don't even *think* of interpreting the interface you
>obtain as a function address. BTW, I'm really interested how you want to
>interface COM without parsing the entire header files for making sure
>that you're not coding the indices for the functions wrong. I've tried
>this once but given up and decided to stay with a wrapper DLL instead.


I haven't figured that one out yet either.  I'll let you know if I come up
with any bright ideas.

Thanks for your help.

Dave Anderson





More information about the Squeak-dev mailing list