unknwn.h: unknwn.idl

Boaz Harrosh boaz at hishome.net
Wed Dec 31 08:55:34 CST 2003


2 Questions

1) if I do "make depend" than edit unknwn.idl (or any other idl) than do 
"make" should a new unknwn.h be compiled?
Well it does not. If I "cd include" and "make" than nothing is done 
either. only if I do "make unknwn.h" it will compile.


2) In order for ATL to compile I need below code in my unknwn.h file. I 
could not fined a way to do it with WIDL.
I have looked in Microsoft (vc6) header/idl and it looks they had the 
same problem. And below code was added by hand.
Now if the answer to Q1 is "No not done automatically" than I guess I 
can submit a patch for unknwn.h only. could I also submit a patch to 
include/Makefile.in to remove unknwn.idl from the list of idl files so 
it will not accidentally over-write unknwn.h?

<unknwn.h snippet>
    ...

DEFINE_GUID(IID_IUnknown, 0x00000000, 0x0000, 0x0000, 0xc0,0x00, 
0x00,0x00,0x00,0x00,0x00,0x46);

#if defined(__cplusplus) && !defined(CINTERFACE)

#if !defined(WINE_NO_UUIDOF)
#include <wine/uuidof.h>
extern "C++" {
#endif

#ifdef ICOM_USE_COM_INTERFACE_ATTRIBUTE
struct __attribute__((com_interface)) IUnknown
#else
struct IUnknown
#endif
{
    virtual HRESULT STDMETHODCALLTYPE QueryInterface(
        REFIID riid,
        void** ppvObject) = 0;

    virtual ULONG STDMETHODCALLTYPE AddRef(
        ) = 0;

    virtual ULONG STDMETHODCALLTYPE Release(
        ) = 0;

#if !defined(WINE_NO_UUIDOF)
    template <class Q>
    HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
    {
        return QueryInterface(__uuidof(Q), (void**)pp);
    }
#endif
};

#if !defined(WINE_NO_UUIDOF)
} // extern "C++"
#endif

#else

    ...
</unknwn.h snippet>

I have tried below simple idl code but it will go to all the wrong places

<bad unknwn.idl code>
    ...

interface IUnknown
{
  typedef [unique] IUnknown *LPUNKNOWN;

  HRESULT QueryInterface(
    [in] REFIID riid,
    [out, iid_is(riid)] void **ppvObject);
  ULONG AddRef();
  ULONG Release();
cpp_quote("#if !defined(WINE_NO_UUIDOF)")
cpp_quote("template <class Q>")
cpp_quote("HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)")
cpp_quote("{")
cpp_quote("    return QueryInterface(__uuidof(Q), (void**)pp);")
cpp_quote("}")
cpp_quote("#endif")

}

cpp_quote("#if !defined(WINE_NO_UUIDOF)")
cpp_quote("} /*extern C++*/")
cpp_quote("#endif")

    ...
</bad unknwn.idl code>




More information about the wine-devel mailing list