Greeings!
My c to d header wrapper file curl_d.c (just 2 lines):
#include <curl/curl.h>
#include <windows.h> //seems with or without this doesn't matter
Trying A: My main c file :direct_call_c.c:
#include <stdio.h>
#include <string.h>
#include "curl_d.c"
{...}
>dmd -m64 direct_call_c.c curl_d.c curl.lib
...
direct_call_c.obj : error LNK2019: 无法解析的外部符号 _InterlockedExchangeAdd,函数 _InlineInterlockedAdd 中引用了该符号
direct_call_c.obj : error LNK2019: 无法解析的外部符号 _InterlockedExchangeAdd64,函数 _InlineInterlockedAdd64 中引用了该符号 direct_call_c.obj : error LNK2019: 无法解析的外部符号 _mul128,函数 MultiplyExtract128 中引用了该符号
direct_call_c.obj : error LNK2019: 无法解析的外部符号 __shiftright128,函数 MultiplyExtract128 中引用了该符号
direct_call_c.obj : error LNK2019: 无法解析的外部符号 _umul128,函数 UnsignedMultiplyExtract128 中引用了该符号
direct_call_c.obj : error LNK2019: 无法解析的外部符号 __stosb,函数 RtlSecureZeroMemory 中引用了该符号
direct_call_c.obj : error LNK2019: 无法解析的外部符号 __readgsqword,函数 NtCurrentTeb 中引用了该符号
direct_call_c.obj : error LNK2019: 无法解析的外部符号 __imp_MapViewOfFileNuma2,函数 MapViewOfFile2 中引用了该符号
direct_call_c.obj : error LNK2019: 无法解析的外部符号 __imp_CharUpperW,函数 ua_CharUpperW 中引用了该符号
direct_call_c.exe : fatal error LNK1120: 9 个无法解析的外部命令
Error: linker exited with status 1120
Which means unsolved external symbos _InterlockedExchangeAA...
Trying B: D code test01.d:
import core.stdc.stdio;
import curl_d;
{...}
dmd -m64 test01.d curl_d.c curl.lib
Exact the same error message when compiling.
The same c code in pure c using msvc/gcc is just fine with providing only curl.lib,compiles and runs as expected.
In D here,what I was missing to provide?I tried to add many many windows libs like winspool.lib ws2_32.lib wsock32.lib websocket.lib advapi32.lib advpack.lib crypt32.lib icm32.lib icu.lib iepmapi.lib httpapi.lib kernel32.lib mapi32.lib mi.lib mincore.lib mmc.lib msi.lib msxml6.lib normaliz.lib nt.lib ntdll.lib winhttp.lib wininet.lib wiaguid.lib wer.lib wecapi.lib webauthn.lib vssapi.lib wldap32.lib wmip.lib wmiutils.lib wsnmp32.lib wtsapi32.lib,even ucrt.lib .... but it doesn't make any sense.
So what's the real issue behind?
Anyone help on this would be appreciated.