Some DNS API functions cause LNK2019 errors in x86 (32 bit) builds

Davide Beatrici 1 Reputation point

Some DNS API functions (such as DnsServiceConstructInstance(), DnsServiceFreeInstance(), DnsServiceRegister(), DnsServiceDeRegister() and DnsServiceRegisterCancel()) are declared without the WINAPI modifier, causing them to use __cdecl instead of __stdcall.

Forcing the use of __stdcall (/Gz MSVC option) allows to work around the issue.

Thanks to Russ Keldorph for investigating the issue:

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,352 questions
{count} votes