Compiler Warning (level 1 and 3) C4793
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Warning (level 1 and 3) C4793

Error Message

'reason' : causes native code generation for function 'function'

function was compiled to unmanaged, native code, even though the file was compiled /clr. The compiler will not be able to create an MSIL version of the function if the function includes setjmp, inline assembly, or a parameter list that includes a variable number of parameters.

This is a level 1 warning when compiling with /clr:pure.


The following sample generates C4793.

// C4793.cpp
// compile with: /clr /W3 /c
// processor: x86
int asmfunc(void) {   // C4793, compiled as unmanaged, native code
   __asm {
      mov eax, 0

The following sample generates C4793.

// C4793_b.cpp
// compile with: /clr:pure /WX
#include <setjmp.h>
jmp_buf test_buf;

void f() {
   setjmp(test_buf)   // C4793 warning
© 2015 Microsoft