B
_BNC
I've been adapting an older unmanaged C++ legacy app to C#---with limited
success. The original app made use of an older, but straightforward, C
DLL that worked efficiently under the VC++ 6 model.
To adapt to C#, I've wrapped the older DLL calls in an unmanaged C++
class which pretty much just parallels the original function calls and
encapsulates the more ragged aspects (handles, etc).
Then in turn, I wrapped the unmanaged C++ class in a managed C++ class.
All tedious but not real tricky. The C# code seems happy to instantiate
and call the managed C++ class. Preliminary test code executes with no
memory leaks and all execution paths seem intact.
The problem: The internal C DLL has functions that run in a thread.
That thread does not seem to run efficiently in the final C# program.
It's tough to gauge a difference in terms of exec time, but the C DLL's
time-critical code is no longer reliable.
Two reasons occurred to me:
1: The exec-time transition between the C#/C++Managed/C++ Unmanaged code
is very slow. I mean *very* slow. The older app runs fine on older
generation Pentiums.
2: The threading model in the managed code is significantly different in
some way that is affecting the underlying C code.
Ideas or random speculation is welcome.
success. The original app made use of an older, but straightforward, C
DLL that worked efficiently under the VC++ 6 model.
To adapt to C#, I've wrapped the older DLL calls in an unmanaged C++
class which pretty much just parallels the original function calls and
encapsulates the more ragged aspects (handles, etc).
Then in turn, I wrapped the unmanaged C++ class in a managed C++ class.
All tedious but not real tricky. The C# code seems happy to instantiate
and call the managed C++ class. Preliminary test code executes with no
memory leaks and all execution paths seem intact.
The problem: The internal C DLL has functions that run in a thread.
That thread does not seem to run efficiently in the final C# program.
It's tough to gauge a difference in terms of exec time, but the C DLL's
time-critical code is no longer reliable.
Two reasons occurred to me:
1: The exec-time transition between the C#/C++Managed/C++ Unmanaged code
is very slow. I mean *very* slow. The older app runs fine on older
generation Pentiums.
2: The threading model in the managed code is significantly different in
some way that is affecting the underlying C code.
Ideas or random speculation is welcome.