2011/3/5 Georgi Petrov <gogothe...@gmail.com>: > On Sat, Mar 5, 2011 at 2:48 PM, Kai Tietz <ktiet...@googlemail.com> wrote: >> 2011/3/5 Georgi Petrov <gogothe...@gmail.com>: >>> Hi, >>> >>> I have a quick question. I can't figure out something. I have the >>> following COM function definition: >>> STDAPI MFCreateVideoRenderer(REFIID riidRenderer, void ** ppVideoRenderer); >>> >>> The first parameter (riidRenderer) is Interface indentifier (IID) of a >>> COM class. When calling MFCreateVideoRenderer, I want to pass a >>> particular IID, for example IID_IMFMediaSink. >>> >>> In C++, I would write: >>> MFCreateVideoRenderer(__uuidof (IID_IMFMediaSink), ... >>> >>> However, in C, this is not possible. The GUID of my desired interface >>> (IID_IMFMediaSink) is >>> 0x6ef2a660,0x47c0,0x4666,0xb1,0x3d,0xcb,0xb7,0x17,0xf2,0xfa,0x2c and I >>> have defined it myself like this: >>> >>> DEFINE_GUID(IID_IMFMediaSink, >>> 0x6ef2a660,0x47c0,0x4666,0xb1,0x3d,0xcb,0xb7,0x17,0xf2,0xfa,0x2c); >>> >>> Then how can I "convert" it to a suitable first parameter of >>> MFCreateVideoRenderer? I've been stuck with this problem for 2 days >>> and I really can't figure it out. Any help will be appreciated! >>> >>> Georgi >> >> Well, pretty easy. Just pass to this function the address of the GUID. >> the __uuidof keyword in fact returns a const GUID * for C (for C++ it >> is a const GUID &). >> >> Regards, >> Kai > > Hi Kai, > > I believe that __uuidof() is C++ specific operator only. At least this > is the information I got from various places. When used in C, I get > "implicit declaration of function '__uuidof'". > > The REFIID parameter which my function expects is actually "const > struct GUID * const", while DEFINE_GUID is of type "GUID". Can you > give me with a simple one line cast of some sort, which actually > works? I'm pretty lost. >
GUID IDD_SomeId = { .... }; for C the argument would be then func (&IDD_SomeId); If you are doing this with C++ uses then ((REFID) &IDD_SomeId, ...); Kai ------------------------------------------------------------------------------ What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public