From: Q33NY on
Hi,

I've posted this question on the VC++ general forum but someone instructed
me to post it here.

I have a cpp program that uses ntddk.h(located in
$(DDK_INSTALL_DIR)\inc\ddk\wnet) - the ddk version is 3790.1830. I am trying
to compile it using MsVStudio2005(via project or Makefile). It works for
target machine X86 and IA64, but when i try to compile it for AMD64, i get
this error:

E:\WINDDK\3790.1830\inc\ddk\wnet\ntddk.h(10139) : error C4430: missing type
specifier - int assumed. Note: C++ does not support default-int

the compiler command is(and the vcvars are set to x86_amd64):

cl /nologo /GS /DWIN32 /D_WIN32 /W3 /D_WINNT /EHsc /c /DZLIB_WINAPI /DNDEBUG
/D_MBCS /MT /D_MT /X /TP /Wp64 /D_AMD64_=1 /DWIN64 /D_WIN64 /I "E:\Program
Files\Microsoft Visual Studio 8\VC\include" /I "E:\Program Files\Microsoft
Platform SDK for Windows Server 2003 R2"\Include /I "E:\Program
Files\Microsoft Platform SDK for Windows Server 2003 R2"\Include\crt /I
..\zlib\include /I E:\WINDDK\3790.1830\inc\ddk\wnet /I
E:\WINDDK\3790.1830\inc\wnet .\Process.cpp /Fo".\int_x64\Process.obj"
Process.cpp


Indeed when i took a look in ntddk.h file i found this:

The following piece of code starts at line 10129:

#define ExInterlockedExchangeUlong(Target, Value, Lock) \
_ExInterlockedExchangeUlong(Target, Value)

__forceinline
//ULONG
_ExInterlockedExchangeUlong (
IN OUT PULONG Target,
IN ULONG Value
)

{

return (ULONG)InterlockedExchange((PLONG)Target, (LONG)Value);
}




It's clear that the return type is missing(I added the "//ULONG" line there
and if i decomment that, it compiles fine on AMD64).

Is this a known issue? Is simply adding the return type a workaround that Ms
encourages?

Note: There's another workaround, using another compiler(well with slightly
different flags) - the one located here: "E:\Program Files\Microsoft Platform
SDK for Windows Server 2003 R2\Bin\win64\x86\AMD64\" - but that is not an
acceptable solution for me.

Regards,

Cristi Fati.


From: Maxim S. Shatskih on
> I have a cpp program that uses ntddk.h(located in
> $(DDK_INSTALL_DIR)\inc\ddk\wnet) - the ddk version is 3790.1830.

5 years obsolete. Use WDK 6001.18002 for w2k support, and, if you can afford dropping w2k - then the latest Win7 WDK.

Why do you need to include ntddk.h to user-mode project?

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com

From: Q33NY on
Sadly this is part of the build environment at my work place and probably it
will be updated in the future, but this is not the case now, since it would
mess up many of our components which are working.

the project that i'm working gathers data about the computer that it is
running on(i didn't write the code, i just have to build it for IA64).

But there is a bug in that file right?(i mean if i want to use the vs2005
compiler - cause older compilers automatically assign int as a return type
for a function that doesn't have one)
From: Tim Roberts on
Q33NY <Q33NY(a)discussions.microsoft.com> wrote:
>...
>the project that i'm working gathers data about the computer that it is
>running on(i didn't write the code, i just have to build it for IA64).

You mean AMD64, right?

>But there is a bug in that file right?

Yes. The 6000 WDK adds the ULONG.
--
Tim Roberts, timr(a)probo.com
Providenza & Boekelheide, Inc.
From: Q33NY on
I am trying to compile it on IA64, but the AMD64 throws the error. Til now
the amd64 binary was built using another(older) compiler/linker which
automatically added the int return type, but i don't want to do that.


Thank you for your answer, it's just what i needed.

"Tim Roberts" wrote:

> Q33NY <Q33NY(a)discussions.microsoft.com> wrote:
> >...
> >the project that i'm working gathers data about the computer that it is
> >running on(i didn't write the code, i just have to build it for IA64).
>
> You mean AMD64, right?
>
> >But there is a bug in that file right?
>
> Yes. The 6000 WDK adds the ULONG.
> --
> Tim Roberts, timr(a)probo.com
> Providenza & Boekelheide, Inc.
> .
>