Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2007

Tip: Looking for answers? Try searching our database.

problem with latest platform SDK and intrin.h

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jonathan Wilson - 02 Jun 2007 06:36 GMT
I am using the current platform SDK headers and libraries (including the
CRT headers and static CRT libraries). If I #include windows.h and intrin.h
in the same source file, the compiler spits out error C2733: second C
linkage of overloaded function '_interlockedbittestandset' not allowed
(doesn't matter if I #include intrin.h or windows.h first).
It doesn't happen if I use the header files and libraries that come with
Visual C++ 2005 pro.
Does anyone know why this is and what I can do about it?
Tom Walker - 02 Jun 2007 17:50 GMT
>I am using the current platform SDK headers and libraries (including the
>CRT headers and static CRT libraries). If I #include windows.h and intrin.h
[quoted text clipped - 4 lines]
> Visual C++ 2005 pro.
> Does anyone know why this is and what I can do about it?

There are 2 conflicting declarations of _interlockedbittestandset.

In intrin.h the first argument is long *
In WinNT.h the first argument is long volatile *

I'm not sure which declaration is correct but my solution was to edit
intrin.h and add the volatile keyword.
Norman Diamond - 04 Jun 2007 02:41 GMT
>>I am using the current platform SDK headers and libraries (including the
>>CRT headers and static CRT libraries). If I #include windows.h and
[quoted text clipped - 12 lines]
> I'm not sure which declaration is correct but my solution was to edit
> intrin.h and add the volatile keyword.

To me the C++ standard says there was no collision.  Page 214, last
paragraph:
*  Only the const and volatile type-specifiers at the outermost level of the
*  parameter type specification are ignored in this fashion; const and
*  volatile type-specifiers buried within a parameter type specification are
*  significant and can be used to distinguish overloaded function
*  declarations.
Carl Daniel [VC++ MVP] - 04 Jun 2007 03:50 GMT
>>> I am using the current platform SDK headers and libraries
>>> (including the CRT headers and static CRT libraries). If I #include
[quoted text clipped - 22 lines]
> function
> *  declarations.

The outermost level would be the difference between long * and long *
voliatile.  In this case, the difference is between long volatile * and long
*, so the cv-qualifier is buried inside the declared type and does make a
difference.  The compiler is complaining that since the function has C
linkage, it can't have two different overloads that differ only by CV
qualifiers as those are two separate function definitions s for C++, but a
single function definition for C.

-cd
Norman Diamond - 04 Jun 2007 06:56 GMT
>>>> I am using the current platform SDK headers and libraries (including
>>>> the CRT headers and static CRT libraries). If I #include windows.h and
[quoted text clipped - 25 lines]
> long *, so the cv-qualifier is buried inside the declared type and does
> make a difference.

OK, you agreed with me on that part of it, so you wasted time agreeing with
me before explaining why that part of it was irrelevant.  Now just for
clarification, I'll agree with you on the part that seems to be relevant:

> The compiler is complaining that since the function has C linkage, it
> can't have two different overloads that differ only by CV qualifiers as
> those are two separate function definitions s for C++, but a single
> function definition for C.
>
> -cd

OK yes, with C linkage that looks like a collision.  With C linkage nearly
any kind of overload would be a collision.

Now where did I read rumours that Microsoft had started doing some
dogfooding again...

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.