Skip to content

Latest commit

 

History

History
34 lines (28 loc) · 1.06 KB

compiler-warning-level-3-c4792.md

File metadata and controls

34 lines (28 loc) · 1.06 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 3) C4792
Compiler Warning (level 3) C4792
11/04/2016
C4792
C4792
c047ce69-a622-44e1-9425-d41aa9261c61

Compiler Warning (level 3) C4792

function 'function' declared using sysimport and referenced from native code; import library required to link

A native function that was imported into the program with DllImport was called from an unmanaged function. Therefore, you must link to the import library for the DLL.

This warning cannot be resolved in code or by changing the way you compile. Use the warning pragma to disable this warning.

The following sample generates C4792:

// C4792.cpp
// compile with: /clr /W3
// C4792 expected
using namespace System::Runtime::InteropServices;
[DllImport("msvcrt")]
extern "C" int __cdecl puts(const char *);
int main() {}

// Uncomment the following line to resolve.
// #pragma warning(disable : 4792)
#pragma unmanaged
void func(void){
   puts("test");
}