internal static Cci.PInvokeAttributes MakeFlags(bool noMangle, CharSet charSet, bool setLastError, CallingConvention callingConvention, bool?useBestFit, bool?throwOnUnmappable) { Cci.PInvokeAttributes result = 0; if (noMangle) { result |= Cci.PInvokeAttributes.NoMangle; } switch (charSet) { case CharSet.Ansi: result |= Cci.PInvokeAttributes.CharSetAnsi; break; case CharSet.Unicode: result |= Cci.PInvokeAttributes.CharSetUnicode; break; case Cci.Constants.CharSet_Auto: result |= Cci.PInvokeAttributes.CharSetAuto; break; // Dev10: use default without reporting an error } if (setLastError) { result |= Cci.PInvokeAttributes.SupportsLastError; } switch (callingConvention) { default: // Dev10: uses default without reporting an error result |= Cci.PInvokeAttributes.CallConvWinapi; break; case CallingConvention.Cdecl: result |= Cci.PInvokeAttributes.CallConvCdecl; break; case CallingConvention.StdCall: result |= Cci.PInvokeAttributes.CallConvStdcall; break; case CallingConvention.ThisCall: result |= Cci.PInvokeAttributes.CallConvThiscall; break; case Cci.Constants.CallingConvention_FastCall: result |= Cci.PInvokeAttributes.CallConvFastcall; break; } if (throwOnUnmappable.HasValue) { if (throwOnUnmappable.Value) { result |= Cci.PInvokeAttributes.ThrowOnUnmappableCharEnabled; } else { result |= Cci.PInvokeAttributes.ThrowOnUnmappableCharDisabled; } } if (useBestFit.HasValue) { if (useBestFit.Value) { result |= Cci.PInvokeAttributes.BestFitEnabled; } else { result |= Cci.PInvokeAttributes.BestFitDisabled; } } return(result); }
internal DllImportData(string moduleName, string entryPointName, Cci.PInvokeAttributes flags) { _moduleName = moduleName; _entryPointName = entryPointName; _flags = flags; }