Re: generic-msvc.h(91): error C2664

From: Vicky Vergara <vicky_vergara(at)hotmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: generic-msvc.h(91): error C2664
Date: 2017-11-22 15:42:20
Message-ID: BY1PR11MB0423C5EF07E6752227ED4F108A200@BY1PR11MB0423.namprd11.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello all

FYI: I think I solved it by not including the files and only using

extern "C" {

extern
void* SPI_palloc(size_t size);

extern void *
SPI_repalloc(void *pointer, size_t size);

extern void
SPI_pfree(void *pointer);

}

Thanks

Vicky

________________________________
De: Vicky Vergara <vicky_vergara(at)hotmail(dot)com>
Enviado: martes, 21 de noviembre de 2017 09:01 p. m.
Para: pgsql-hackers(at)postgresql(dot)org
Asunto: generic-msvc.h(91): error C2664

Hello all

I am trying to compile pgRouting on appveyor CI when compiling with pg >= 9.5

I am getting the following error:

C:\Program Files\PostgreSQL\9.5\include\server\port/atomics/generic-msvc.h(91): error C2664: '__int64 _InterlockedCompareExchange64(volatile __int64 *,__int64,__int64)' : cannot convert argument 1 from 'volatile uint64 *' to 'volatile __int64 *' [C:\build\pgrouting\build\pg95\x64\src\tsp\tsp.vcxproj]

This error happens when C++ code that needs palloc is being compiled.

There is no problem when compiling C code.

On the documentation of the _InterlockedExchangeAdd64 [1] there is no uint64 * type

This code [2] use [3] where uint64 is used

Maybe I am doing something wrong including some postgres files on these [4] & [5].

A sample compilation with this error is in [6] and there is no problem at all with pg 9.4 [7]

Any feedback would be greatly appreciated

Vicky

[1] https://docs.microsoft.com/en-us/cpp/intrinsics/interlockedexchangeadd-intrinsic-functions

[2] https://github.com/postgres/postgres/blob/REL9_5_STABLE/src/include/port/atomics/generic-msvc.h#L101

[3] https://github.com/postgres/postgres/blob/REL9_5_STABLE/src/include/port/atomics/generic-msvc.h#L43

[4] https://github.com/cvvergara/pgrouting/blob/appveyor-pg95/include/cpp_common/pgr_alloc.hpp

[5] https://github.com/cvvergara/pgrouting/blob/appveyor-pg95/include/c_common/postgres_connection.h

[6] https://ci.appveyor.com/project/cvvergara/pgrouting/build/2.6.1936#L415

[7] https://ci.appveyor.com/project/cvvergara/pgrouting/build/2.6.1934
<https://github.com/postgres/postgres/blob/master/src/include/port/atomics/generic-msvc.h#L41>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David CARLIER 2017-11-22 15:43:53 Re: [PATCH] using arc4random for strong randomness matters.
Previous Message David Fetter 2017-11-22 15:37:14 Re: [PATCH] using arc4random for strong randomness matters.