eclipse-iceoryx / iceoryx

Eclipse iceoryx™ - true zero-copy inter-process-communication
https://iceoryx.io
Apache License 2.0
1.57k stars 373 forks source link

ssize_t: redefinition; different basic types #2209

Open afpgit opened 4 months ago

afpgit commented 4 months ago

Required information

Operating system: Windows 11

Compiler version: Visual Studio 2022 Community

Eclipse iceoryx version: v2.0.3

Observed result or behaviour: Error C2371: ssize_t: redefinition; different basic types

C:\Dev\vcpkg\installed\x64-windows\include\iceoryx\v2.0.3\iceoryx_hoofs/platform/types.hpp(25): error C2371: 'ssize_t': redefinition; different basic types 
C:\Dev\vcpkg\installed\x64-windows\include\httplib.h(137): note: see declaration of 'ssize_t'

The iceoryx definition using ssize_t = size_t; versus that of cpp-httplib:

#if defined(_MSC_VER)
#if _MSC_VER < 1900
#error Sorry, Visual Studio versions prior to 2015 are not supported
#endif

#pragma comment(lib, "ws2_32.lib")

#ifdef _WIN64
using ssize_t = __int64;
#else
using ssize_t = long;
#endif
#endif // _MSC_VER

Expected result or behaviour: Is there anyway around this redefinition of ssize_t along with this header-only library: cpp-httplib?

elBoberido commented 4 months ago

There is a iox_ssize_t defined in unistd.hpp.

I think we can move that definition to types.hpp and use everywhere on the Windows platform iox_ssize_t.

Might also be a good idea to use __int64 on 64 bit.

Do you want to create a PR?

afpgit commented 4 months ago

Yes, I will create a PR.

Which branch should the PR be based on? Originally, I used vcpkg that installs iceoryx version v2.0.3.

elBoberido commented 4 months ago

Can you target the master branch?

Not sure we will do another 2.0.x release since the 3.0.0 release is not far away.