NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

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 sysimport 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:

// compile with /com+ /W3
#using <mscorlib.dll>
[sysimport(dll="msvcrt")]
extern "C" int __cdecl puts(const char *);

void main() {
}
// uncomment the following line to disable C4792
// #pragma warning(disable : 4792)
#pragma unmanaged
void func(void) {
   puts("test");   // C4792
}