jobrems
asked on
Are system calls more reliable from MFC than .NET?
Are there any known problems with making system calls (such as Desktop calls, WIndowing calls, or ShellExecute or CreateProcess) in .NET? Is it better to write such an application in MFC?
Sometimes is more easy to make system calls from native code (MFC) because you can use "ready to use" include files. As jaime_olivares said you have also little better performance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your detailed answer. I also wanted to know: Are there some system calls which, when made from unmanaged code in .NET, execute incorrectly or with unexpected results?
It's kind of complicated. Most calls work fine. Calls that involve callbacks can get you into trouble. I've also seen people frequently get into trouble with calls that take pointers to character buffers. There are other ways to get into trouble, but the more you know the less likely that is to happen. I think the best advice would be only programmers with a solid understanding of the CLR, C/C++, and the Win32 API should be making these mappings. There is a little bit more to it than meets the eye, especially with calls that take pointers to various objects. In the hands of someone with a thorough understanding of the various issues, you will be fine.
Of course there is a little cost to invoke WinAPI function from .net, since .net makes additional checkings.