On Wed, 2003-12-10 at 00:12, Andrew de Quincey wrote:
Yeah, I've played with it under windows... an ITypeInfo is supposed to AddRef() the ITypeLib ONCE when its retrieved using things like ITypeLib.FindName(). (when you release it, you do it just once as well, when the original refcount at which it was AddRef()ed is reached). This ain't happening. Yet.
I don't remember exactly what I did, but I remember it being classed as "wrong" somehow... I expect it was reffing things too many times.
I've also found a number of other bugs in that file; specifically theres a lot of confusion between BSTR and OLESTR going on, which really really knackers things. Easy to do though: they've just confused the hell out of me!! So a BSTR is the same type as an OLESTR to the C compiler, EXCEPT it has a fancy hidden DWORD before the actual buffer giving the number of bytes used! Thats not at all confusing is it?
Indeed. BSTR is quite possibly the most moronic string type I've ever seen.
For the interested lurkers amongst us, here is a useful guide to BSTR semantics I stumbled across some time ago. They use it internally in Redmond:
http://blogs.gotdotnet.com/ericli/PermaLink.aspx/853ae05f-7610-4531-ab1b-070...
It's good to have another person who understands OLE on board! I spent months getting to grips with the darn thing, and now I don't have any spare time to work on it :(