Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
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.

Compiler Warning C4394

Error Message

'function' : per-appdomain symbol should not be marked with __declspec(dllexport)

A function marked with the appdomain __declspec modifier is compiled to MSIL (not to native), and export tables (export __declspec modifier) are not supported for managed functions.

You can declare a managed function to have public accessibility, see Type and Member Visibility for more information.

C4394 is always issued as an error. You can turn off this warning with the #pragma warning or /wd; see warning or /w, /Wn, /WX, /Wall, /wln, /wdn, /wen, /won (Warning Level) for more information.

Example

The following sample generates C4394.

// C4394.cpp
// compile with: /clr /c
__declspec(dllexport) __declspec(appdomain) int g1 = 0;   // C4394
__declspec(dllexport) int g2 = 0;   // OK

Community Additions

ADD
Show:
© 2015 Microsoft