Buna bir bakın. İşlev 1.1'den beri olmuştur, bu yüzden hangi .NET sürümünü kullanıyor olmalısınız. Sadece CallingConvention'ı belirtmelisiniz.
CallingConvention Documenation at MSDN
Ayrıca Kod Projesi bu makalede bakabilirsiniz:
Using the _CDECL calling convention in C#
EDIT: Ayrıca, İşte FreeImage.NET bir örnektir.
static FreeImage_OutputMessageFunction freeimage_outputmessage_proc = NULL;
DLL_API void DLL_CALLCONV
FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf);
Sonra sadece C# tarafında, tarih:
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void FreeImage_OutputMessageFunction(FREE_IMAGE_FORMAT
format, string msg);
[DllImport(dllName, EntryPoint="FreeImage_SetOutputMessage")]
public static extern void SetOutputMessage(FreeImage_OutputMessageFunction
omf);
sen (yönetilmeyen kod çağırabilir yani 'Cdecl' fonksiyonu) C# bir' Cdecl' geri arama yaratmaya çalıştığını, yoksa sen C# gelen yönetilmeyen (yani yerli C) 'Cdecl' işlevini aramak için çalışıyoruz? –