You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Abhijit Savarkar <ab...@geometricsoftware.com> on 2000/01/20 08:54:39 UTC

Xerces-C-src_1_0_1 win32 build error

Hello,

I am new to apache XML parser and have downloaded source code from xml
apache site

When I try to build the same on my Win NT4.0 VC6.0 it gives following error

xerces-c-src_1_0_1\src\util\platforms\win32\win32platformutils.cpp(630) :
error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1 from
'void ** ' to 'long *'

The code segment it refers to is

<function name>

//  Miscellaneous synchronization methods
// ---------------------------------------------------
void*
XMLPlatformUtils::compareAndSwap(       void**      toFill
                                , const void* const newValue
                                , const void* const toCompare)

<affected lines>

    //
    //  Note we have to cast off the constness of some of these because
    //  the system APIs are not C++ aware in all cases.
    //
    return (void*)::InterlockedCompareExchange
    (
        toFill
        , (void*)newValue
        , (void*)toCompare
   )


Any pointers on how to get it build correctly will be of great help.

Thank you,
Abhijit
--------------------------------
abhijits@geometricsoftware.com
--------------------------------


Re: Xerces-C-src_1_0_1 win32 build error

Posted by Andy Heninger <he...@us.ibm.com>.
Try it again.

I removed the DEVENV_VCPP preprocessor variable, which was not being set
consistently anyway.
The inline assembly will now always be used when compiling with MSVC, which
should sidestep the problem of inconsistent definitions of
InterlockedCompareExchange.

But I'm still curious as to where the different definitions came from.

  -- Andy


Re: Xerces-C-src_1_0_1 win32 build error

Posted by Andy Heninger <he...@us.ibm.com>.
I'm confused.

Here's the definition of InterlockedCompareExchange from my installation of
VC6, in file
whatever\VC98\Include\WINBASE.h

WINBASEAPI
PVOID
WINAPI
InterlockedCompareExchange (
    PVOID *Destination,
    PVOID Exchange,
    PVOID Comperand
    );

This matches the parameter types, and builds just fine.  So the question is,
is there some other definition of InterlockedCompareExchange floating
around, and if so, when and where, and how can we avoid picking it up?  I
couldn't find any other.

There's another problem too.  The call to InterlockedComparExchange should
not be used, but we should be building the inline assembly code instead.
There's some problem with the DEVENV_VCPP setting, which I'll look into.

The main reason for avoiding InterlockedCompareExchange is that it does not
exist on Windows 95, but only on Win 98 and NT or better.  The assembly code
relies on a 486 or better processor.  Blowing off 386 processors is a safer
bet than blowing off Win 95.




----- Original Message -----
From: Abhijit Savarkar <ab...@geometricsoftware.com>
To: <xe...@xml.apache.org>
Sent: Wednesday, January 19, 2000 11:54 PM
Subject: Xerces-C-src_1_0_1 win32 build error


> Hello,
>
> I am new to apache XML parser and have downloaded source code from xml
> apache site
>
> When I try to build the same on my Win NT4.0 VC6.0 it gives following
error
>
> xerces-c-src_1_0_1\src\util\platforms\win32\win32platformutils.cpp(630) :
> error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1
from
> 'void ** ' to 'long *'
>
> The code segment it refers to is
>
> <function name>
>
> //  Miscellaneous synchronization methods
> // ---------------------------------------------------
> void*
> XMLPlatformUtils::compareAndSwap(       void**      toFill
>                                 , const void* const newValue
>                                 , const void* const toCompare)
>
> <affected lines>
>
>     //
>     //  Note we have to cast off the constness of some of these because
>     //  the system APIs are not C++ aware in all cases.
>     //
>     return (void*)::InterlockedCompareExchange
>     (
>         toFill
>         , (void*)newValue
>         , (void*)toCompare
>    )
>
>


RE: Xerces-C-src_1_0_1 win32 build error

Posted by Abhijit Savarkar <ab...@geometricsoftware.com>.
Hi Eric,

Actually even I got around the problem by almost doing
the same thing with it. I have posted this here so that
some answer from concerned people in apache will come
about and will endorse the changes.

Thanks For Ur Quick Re.

Abhijit

> -----Original Message-----
> From: Eric Ulevik [mailto:eau@fast.fujitsu.com.au]
> Sent: 20 January, 2000 1:36 PM
> To: xerces-dev@xml.apache.org; abhijits@geometricsoftware.com
> Subject: Re: Xerces-C-src_1_0_1 win32 build error
>
>
> From: Abhijit Savarkar <ab...@geometricsoftware.com>
> > When I try to build the same on my Win NT4.0 VC6.0 it gives following
> error
> >
> >
> xerces-c-src_1_0_1\src\util\platforms\win32\win32platformutils.cpp(630) :
> > error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1
> from
> > 'void ** ' to 'long *'
>
> I fixed this by changing the code to:
>
> return (void*)::InterlockedCompareExchange((long*)toFill,
>  (long)newValue, (long)toCompare);
>
> I've also made a number of other improvments. What should I do to get them
> included?
>
> Thanks,
>
> Eric Ulevik


Re: Xerces-C-src_1_0_1 win32 build error

Posted by Eric Ulevik <ea...@fast.fujitsu.com.au>.
From: Abhijit Savarkar <ab...@geometricsoftware.com>
> When I try to build the same on my Win NT4.0 VC6.0 it gives following
error
>
> xerces-c-src_1_0_1\src\util\platforms\win32\win32platformutils.cpp(630) :
> error C2664: 'InterlockedCompareExchange' : cannot convert parameter 1
from
> 'void ** ' to 'long *'

I fixed this by changing the code to:

return (void*)::InterlockedCompareExchange((long*)toFill,
 (long)newValue, (long)toCompare);

I've also made a number of other improvments. What should I do to get them
included?

Thanks,

Eric Ulevik