Missing library dependencies compiling app with importC
DUser
duser at dlang.org
Sun Feb 25 10:23:26 UTC 2024
On Thursday, 22 February 2024 at 01:23:36 UTC, ptcute wrote:
> ...
> So what's the real issue behind?
>
> Anyone help on this would be appreciated.
They are MSVC compiler intrinsics.
(https://issues.dlang.org/show_bug.cgi?id=23894)
Surprisingly I got it working by just replacing some includes
with definitions in "curl/curl.h".
Change:
```c
#if defined(_WIN32) && !defined(_WIN32_WCE) &&
!defined(__CYGWIN__)
#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || \
defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H))
/* The check above prevents the winsock2 inclusion if winsock.h
already was
included, since they can't co-exist without problems */
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#endif
```
to:
```c
#if defined(_WIN32) && !defined(_WIN32_WCE) &&
!defined(__CYGWIN__)
#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || \
defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H))
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef struct sockaddr {
#if (_WIN32_WINNT < 0x0600)
u_short sa_family;
#else
ADDRESS_FAMILY sa_family; // Address family.
#endif //(_WIN32_WINNT < 0x0600)
char sa_data[14]; // Up to 14 bytes of
direct address.
} SOCKADDR;
#if(_WIN32_WINNT >= 0x0501)
typedef unsigned __int64 u_int64;
#endif //(_WIN32_WINNT >= 0x0501)
#if defined(_WIN64)
typedef unsigned __int64 SOCKET;
#else
typedef unsigned int SOCKET;
#endif
#ifndef FD_SETSIZE
#define FD_SETSIZE 64
#endif /* FD_SETSIZE */
typedef struct fd_set {
u_int fd_count; /* how many are SET? */
SOCKET fd_array[FD_SETSIZE]; /* an array of SOCKETs */
} fd_set;
#endif
#endif
```
At least this example program
(https://curl.se/libcurl/c/getinfo.html) works fine.
More information about the Digitalmars-d-learn
mailing list