Re: generic-msvc.h(91): error C2664 - Mailing list pgsql-hackers

From Vicky Vergara
Subject Re: generic-msvc.h(91): error C2664
Date
Msg-id BY1PR11MB0423C5EF07E6752227ED4F108A200@BY1PR11MB0423.namprd11.prod.outlook.com
Whole thread Raw
In response to generic-msvc.h(91): error C2664  (Vicky Vergara <vicky_vergara@hotmail.com>)
List 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@hotmail.com>
Enviado: martes, 21 de noviembre de 2017 09:01 p. m.
Para: pgsql-hackers@postgresql.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


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: [PATCH] using arc4random for strong randomness matters.
Next
From: David CARLIER
Date:
Subject: Re: [PATCH] using arc4random for strong randomness matters.