Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.1 KB

File metadata and controls

30 lines (21 loc) · 1.1 KB
description title ms.date f1_keywords helpviewer_keywords
Learn more about: Compiler Warning (level 3) C4768
Compiler Warning (level 3) C4768
05/03/2021
C4768
C4768

Compiler Warning (level 3) C4768

__declspec attributes before linkage specification are ignored

The compiler warns if __declspec(...) is applied before the extern "C" linkage specification. Previously, the compiler would ignore the attribute, which could have runtime implications.

Remarks

This warning is new in Visual Studio 2017 version 15.3, which left it off by default. It's enabled by default as a level 3 warning starting in Visual Studio 2017 version 15.5. For information on how to disable warnings by compiler version, see Compiler warnings by compiler version.

Example

The following code produces warning C4768:

__declspec(noinline) extern "C" HRESULT __stdcall // C4768: __declspec attributes before linkage specification are ignored

To fix the warning, put extern "C" first:

extern "C" __declspec(noinline) HRESULT __stdcall