Josh Posted December 22, 2012 Posted December 22, 2012 Is there any way at all to declare a callback function in C# that uses the cdecl calling convention? Quote My job is to make tools you love, with the features you want, and performance you can't live without.
ChrisMAN Posted December 22, 2012 Posted December 22, 2012 http://stackoverflow...ck-with-pinvoke Can't tell if thats good info. Quote
Von04 Posted December 23, 2012 Posted December 23, 2012 Is there any way at all to declare a callback function in C# that uses the cdecl calling convention? Try something like this. [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void MyDelegate(); if using this you'll also want to look into Marshaling e.g. Marshal.GetFunctionPointerForDelegate(Delegate d) //Converts a delegate into a function pointer that is callable from unmanaged code. Marshal.GetDelegateForFunctionPointer(IntPtr ptr, Type t) // Converts an unmanaged function pointer to a delegate I needed to use these when calling native functions from the engine.dll for my LEControl. It's how I finally got the GetSize and MakeCurrent Delegates to work properly. These function are under the System.Runtime.InteropServices namespace. Quote 3d world studio. 3ds Max 8. GTX 260. Visual Studio 2010. Dual Core 2.6 Mhz processor.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.