A couple of questions re. managed vs. unmanaged code.
1. I know this depends on the app, but how much faster is unmanaged code
vs. managed code? Is there an average figure for this?
The code I use has about 5% difference in speed.
It appears that managed code (C#) compiles similar like if you would have a
none-optimized compile of the C++ code.
The things is to avoid calles between managed/unmanaged too much since you
lose transition speed.
Basically I discoverd that in som parts of your code it will runn slower
while other parts will run faster.
I can only advice you to test your specific type of code.
2. Is it as simple as using a #pragma to convert from unmanaged to managed?
And if so, can I simply change my existing code to managed with the #pragma
wherever I want to eliminate transitions, or are there issues with this?
Not exactly.
For the none-MFC code:
But porting from unmanaged C++ to managed C++/C# is very easy, just copy and
paste, then search and replace and remove all deletes and in 90% of the time
it just runs without need of change.
For the MFC code (like windows dialog boxes, Sendmessage()...) this is going
to be a rewrite.
But luckily, Winforms is so user friendly compared to MFC that recreatign
the forms from scracht wil be really fun.
Only one thing I have to warn you. The .NET way has a different philosophy
than the MFC way, so you might have a hard time to change your programming
style. You will probably stumble om some stupid stuff like converting from
string to int and back. It is done different in the .NET way, but in my
opinion very logical. Once you know it. ;-) Also the security model is
integrated into the managed code. For example a default managd program has
default no access to a LAN drive. As a programmer you mist activate this
part, and also the user that installs that program must give right s for
that program to access the LAN drive. Luckily this can be easily configured
if your installer program, so the user does not need to be an expert in
administration. This took me a few months to find the good way of doing, but
it works fine.