Delen via


Compilerwaarschuwing (niveau 1) C4397

DefaultCharSetAttribute wordt genegeerd

Opmerkingen

DefaultCharSetAttribute wordt genegeerd door de Microsoft C++-compiler. Als u een tekenset wilt opgeven voor het DLL-bestand, gebruikt u de optie CharSet van DllImport. Zie C++ Interop (impliciete PInvoke) gebruiken voor meer informatie.

Example

In het volgende voorbeeld wordt C4397 gegenereerd.

// C4397.cpp
// compile with: /W1 /c /clr
using namespace System;
using namespace System::Runtime::InteropServices;

[module:DefaultCharSetAttribute(CharSet::Unicode)];   // C4397

[DllImport("kernel32", EntryPoint="CloseHandle", CharSet=CharSet::Unicode)]   // OK
extern "C" bool ImportDefault(IntPtr hObject);

public ref class MySettingVC {
public:
   void method() {
      ImportDefault(IntPtr::Zero);
   }
};

[StructLayout(LayoutKind::Explicit)]
public ref struct StructDefault1{};

public ref class ClassDefault1{};