hhromic / libe131

libE131: a lightweight C/C++ library for the E1.31 (sACN) protocol
Apache License 2.0
77 stars 20 forks source link

win compilation errors #12

Closed frequenc1 closed 2 months ago

frequenc1 commented 7 months ago

I'm working on a DMX plugin for vcv rack using your awesome library. It's working great on macOS but I'm getting some build problems on win64 build via my actions build on GitHub. I'm using https://github.com/VCVRack/rack-plugin-toolchain to build and they use a common pattern where both the windows and linux builds are done in an ubuntu docker container. My first issue is files are case sensitive on linux so the inclusion of :

#include <WinSock2.h> breaks as the file needs to be for both
#include <winsock2.h>
#include <basetsd.h>

2nd I'm hitting this cascade of errors:

src/clients/e131.c: In function 'e131_unicast_dest':
src/clients/e131.c:81:24: error: storage size of 'hints' isn't known
   81 |   struct addrinfo *ai, hints;
      |                        ^~~~~
src/clients/e131.c:84:7: warning: implicit declaration of function 'getaddrinfo' [-Wimplicit-function-declaration]
   84 |   if (getaddrinfo(host, NULL, &hints, &ai) != 0) {
      |       ^~~~~~~~~~~
src/clients/e131.c:91:45: error: invalid use of undefined type 'struct addrinfo'
   91 |   dest->sin_addr = ((struct sockaddr_in *)ai->ai_addr)->sin_addr;
      |                                             ^~
src/clients/e131.c:95:3: warning: implicit declaration of function 'freeaddrinfo' [-Wimplicit-function-declaration]
   95 |   freeaddrinfo(ai);

On win64 build it can't calculate the sizeof hints. Any thoughts on how to proceed?

// get the address info of the host (the results are a linked list) struct addrinfo *ai, hints; memset(&hints, 0, sizeof hints);

hhromic commented 6 months ago

Apologies for the slow reply, I was on holidays last week :) I will take a look on this, thanks for reporting!

braewoods commented 2 months ago

@hhromic I've patched some other similar issues that came up when building with a MSYS2 environment. Please merge when you can. Thanks.