Hi,
Alex nudged me in IRC about this, but sadly I've not quite figured this out yet.
It appears my definitions for Kernel Streaming GUIDs are not quite right. This results in ugly code like so:
-- const GUID foo_audio_category = STATIC_KSCATEGORY_AUDIO; DoSomethingWithTheGuid(&foo_audio_category); --
Which consequently results in a barrage of compiler complaints about brace initialization.
It should be possible to just do: DoSomethingWithTheGuid(KSCATEGORY_AUDIO);
I'm clearly going wrong somewhere in KS.H or KSMEDIA.H but to be honest am blind to whatever is causing the problem.
If anyone can figure out what I'm doing wrong here, I'd appreciate it.
Thanks.
-Andrew
There are 2 problems with your code. Firstly, in GCC you can't assign a GUID like that without warnings. Expanding out the #define you have this
const GUID foo_audio_category = {0x6994AD04L, 0x93EF, 0x11D0, 0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
to kill the warnings in gcc, you'll need to segregate the struct
const GUID category_guid = {0x6994AD04L, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
If you add the above directly into your code, you should see the 'warning: missing braces around initializer' warnings dissapear.
Secondly, and this is your bigger problem, you've taken code meant for msvc out of the MS headers. Here is your header code:
#define STATIC_KSCATEGORY_AUDIO \ 0x6994AD04L, 0x93EF, 0x11D0, 0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96 DEFINE_GUIDSTRUCT("6994AD04-93EF-11D0-A3CC-00A0C9223196", KSCATEGORY_AUDIO); #define KSCATEGORY_AUDIO DEFINE_GUIDNAMED(KSCATEGORY_AUDIO)
In msvc, to correctly assign the GUID, you should use the DEFINE_GUIDNAMED assigned macro. So for STATIC_KSCATEGORY_AUDIO, there is a KSCATEGORY_AUDIO which expands calls DEFINE_GUIDNAMED(KSCATEGORY_AUDIO)
This expands to #define DEFINE_GUIDNAMED(n) __uuidof(struct n), and that's where your problem lies.
__decelspec(uuid()) and __uuidof are a Microsoft extensions which lets you get and set GUID's to / from the struct. You've dropped these into your headers, which GCC doesn't understand, hence your warnings.
IMO, the 3 solutions are to either 1. assign your GUID manually using the { ... { ... }} convention 2. change the ksmedia.h header to be more GCC friendly 3. add support for __decelspec(uuid()) and __uuidof to our code base. It might be worth checking Wine for this as I think it's been done by them before.
Hope that helps, Ged.
-----Original Message----- From: ros-dev-bounces@reactos.org [mailto:ros-dev-bounces@reactos.org] On Behalf Of reactos-development@silverblade.co.uk Sent: 27 September 2007 19:02 To: Ros dev Subject: [ros-dev] Kernel streaming header mess / GUIDs
Hi,
Alex nudged me in IRC about this, but sadly I've not quite figured this out yet.
It appears my definitions for Kernel Streaming GUIDs are not quite right. This results in ugly code like so:
-- const GUID foo_audio_category = STATIC_KSCATEGORY_AUDIO; DoSomethingWithTheGuid(&foo_audio_category); --
Which consequently results in a barrage of compiler complaints about brace initialization.
It should be possible to just do: DoSomethingWithTheGuid(KSCATEGORY_AUDIO);
I'm clearly going wrong somewhere in KS.H or KSMEDIA.H but to be honest am blind to whatever is causing the problem.
If anyone can figure out what I'm doing wrong here, I'd appreciate it.
Thanks.
-Andrew
_______________________________________________ Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.
Amteus Secure Communications Ltd 57 Cardigan Lane, Leeds, LS4 2LE t: +44 (0) 870 8368770 f: +44 (0) 870 8368701
Registered in England No 4760795
Ged wrote:
IMO, the 3 solutions are to either
- assign your GUID manually using the { ... { ... }} convention
- change the ksmedia.h header to be more GCC friendly
- add support for __decelspec(uuid()) and __uuidof to our code base. It
might be worth checking Wine for this as I think it's been done by them before.
Hope that helps, Ged.
From wine/include/winnt.h line 76:
#ifndef DECLSPEC_UUID # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus) # define DECLSPEC_UUID(x) __declspec(uuid(x)) # else # define DECLSPEC_UUID(x) # endif #endif
http://www.winehq.org/pipermail/wine-devel/2004-March/025393.html
On 9/28/07, James Tabor jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net wrote:
Ged wrote:
IMO, the 3 solutions are to either
- assign your GUID manually using the { ... { ... }} convention
- change the ksmedia.h header to be more GCC friendly
- add support for __decelspec(uuid()) and __uuidof to our code base. It
might be worth checking Wine for this as I think it's been done by them before.
Hope that helps, Ged.
From wine/include/winnt.h line 76:
#ifndef DECLSPEC_UUID # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus) # define DECLSPEC_UUID(x) __declspec(uuid(x)) # else # define DECLSPEC_UUID(x) # endif #endif _______________________________________________ Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
Thanks for the replies... It *should* build with MSVC now. I'm gonna have to fire up my laptop at some point and try building ROS on that, to find out.
The main issue I have at the moment is how to get MinGW/GCC to handle things. As has been pointed out, the header uses MSVC-specific stuff.
So I need to figure out how to do it in a way so that GCC won't regurgitate it at me later.
Doing this has at least shut up all the warnings about "cdecl" only being applicable to functions: #ifndef DEFINE_GUIDEX #ifdef __GNUC__ #define DEFINE_GUIDEX(name) EXTERN_C const GUID name #else #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name #endif #endif
Having changed my code now so that it reads: dev_info = SetupDiGetClassDevsExW(&KSCATEGORY_AUDIO, ......);
It's still doing what it has always done, when linking: [LD] output-i386/base/services/audiosrv/audiosrv.exe obj-i386/base/services/audiosrv/pnp.o: In function `RegisterForDeviceNotifications': /home/silverblade/ReactOS/reactos/base/services/audiosrv/pnp.c:132: undefined reference to `_KSCATEGORY_AUDIO'
(this occurs multiple times, whenever KSCATEGORY_AUDIO is used)
I've tried INIT_GUID and PUT_GUIDS_HERE and all the things I can think of to make it work. i've even tried removing the EXTERN_C from the macros at the top.
Where am I going wrong?
On Sat, 29 Sep 2007 10:49:11 +0100, "Ged Murphy" gedmurphy@gmail.com wrote:
http://www.winehq.org/pipermail/wine-devel/2004-March/025393.html
On 9/28/07, James Tabor jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net wrote:
Ged wrote:
IMO, the 3 solutions are to either
- assign your GUID manually using the { ... { ... }} convention
- change the ksmedia.h header to be more GCC friendly
- add support for __decelspec(uuid()) and __uuidof to our code base.
It
might be worth checking Wine for this as I think it's been done by
them
before.
Hope that helps, Ged.
From wine/include/winnt.h line 76:
#ifndef DECLSPEC_UUID # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus) # define DECLSPEC_UUID(x) __declspec(uuid(x)) # else # define DECLSPEC_UUID(x) # endif #endif _______________________________________________ Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev