DllImportAttribute Supported FieldsĀ
The DllImportAttribute attribute provides specifications for calling an unmanaged function. The .NET Compact Framework provides a subset of the attribute fields for this class, as described in the following table.
DllImportAttribute field | Description |
---|---|
Specifies the DLL entry point to be called. The default entry point name is the name of the managed method. |
|
Controls the name mangling and the way that String parameters should be marshaled. The .NET Compact Framework only supports System.Runtime.InteropServices.CharSet.Unicode and System.Runtime.InteropServices.CharSet.Auto. System.Runtime.InteropServices.CharSet.Auto equates to System.Runtime.InteropServices.CharSet.Unicode on Windows CE. The default marshaling on the .NET Compact Framework is System.Runtime.InteropServices.CharSet.Unicode, unlike the .NET Framework that defaults to System.Runtime.InteropServices.CharSet.Ansi. Because the .NET Compact Framework does not support the System.Runtime.InteropServices.DllImportAttribute.ExactSpelling field, the common language runtime automatically searches for an entry point according to the values specified by CharSet. |
|
Specifies the calling-convention values used in passing method arguments. The default is System.Runtime.InteropServices.CallingConvention.Winapi, which corresponds to __cdecl on the Windows CE platform. |
|
Enables the caller to use the GetLastWin32Error method to determine whether an error occurred while executing the platform invoke method. In Visual Basic 2005, the default is true; in C#, the default is false. |
Note |
---|
Because the .NET Compact Framework does not support the ExactSpelling field, the common language runtime automatically searches for an entry point according to the values specified by CharSet. |