Monthly Archives: July 2007

rare usage scenarios of C++ presented some rarely used scenario of C++. RTTI Sniping in order to provide a fast implementation replacing dynamic_cast. Vptr Jamming in order to change type of an object (between types of the same allocated size) Pointer Hydration in order … Continue reading

Posted in Books | Leave a comment

local static object initialization is not thread safe and also compiler dependent

There is already a post ( on the not thread safe aspect. When I am preparing a demo of Loki to someone, I found that it was also compiler dependent.VC++ 2005 is likely only initialize the object once, but the … Continue reading

Posted in IDE | Leave a comment

undefined reference to _IID_IUnknown in cygwin

I have already added uuid to linker library list, the linker does not complain on uuid. But the problem is fixed by adding libuuid.a to library list. At last it turned out to be caused by order of libraries. After … Continue reading

Posted in IDE | Leave a comment


Imported a VC++ project into Code::Blocks, and changed the compiler to gcc (MingW). Code::Blocks does not change compiling flags and linking options accurately. Some VC++ flags are imported directly, however they are not applicable to gcc. After some efforts I … Continue reading

Posted in IDE | Leave a comment

Wrapper class for using UDT (User Defined Type) in COM

UDTs must be freed by caller, just like BSTR. So I created a template to ease the work of caller.template <typename UDT >class UDTWrapper : public UDT{public: UDTWrapper() { HRESULT hr = S_OK; CComPtr<ITypeLib> pTypelib; CComPtr<ITypeInfo> pTypeInfo; hr = LoadRegTypeLib(lib_id, … Continue reading

Posted in COM | Leave a comment

Firefox displays blank page for many urls

Today when I am surfing internet, suddenly Firefox can’t open new pages correctly — just be blank. After launching TCPView.exe I found rundll.exe (PID=4848) making lots of connection attempts, much like a virus/worm, so I killed it and firefox resumed … Continue reading

Posted in Virus/Worm | Leave a comment

COM Client Method Call Fails with ERROR_NOACCESS(0xC0000005)

I encountered this problem in recent project development. It is very likely to be the same problem as documented in MSDN Q273721. Only one method failed, because it contains a parameter of IUnknown*. Another related KB article may be Q149231 … Continue reading

Posted in COM | Leave a comment