הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
DefaultCharSetAttribute is ignored
Remarks
DefaultCharSetAttribute is ignored by the Microsoft C++ compiler. To specify a character set for the DLL, use the CharSet option of DllImport. For more information, see Using C++ Interop (Implicit PInvoke).
Example
The following example generates C4397.
// 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{};