unsafe code blocks verses using COM interoperability? (best practice)

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

Hi

I have existing c++ dlls that I need to access from a C# application.
Would it be best to convert and move the code into unsafe blocks within
the C# application or access the dlls via COM interoperability. I ask
the question with speed, reliability and implementation effort in mind.

Any thoughts?
 
From such a vague description I'm going to say neither. What makes you feel
they need to be unsafe or COM? There's not inherently some need for a
P/Invoke to be either.

-Chris
 
Are the Dlls already COM components? If not are they in C++ and do they have
a natural fit to the interface based COM model? Which is faster and easier
depends on those issues and the skills of you and your development team.
There really isn't a one size fits all answer. As to performance - I've
never tried to compare an implementation to find out. I'd expect you
wouldn't have any noticeable differences except in high performance cases
where you were doing many calls to the native code in a loop. In which case
it's probably better to code the loop in native code too, if possible.
 
Back
Top