In our project we are reusing lot's of Delphi code through COM in our asp.net application.
Like this: legacy delphi dll => delphi COM wrapper => .Net interop => asp.net (mvc)
We have some issues regarding access violations, unloading of dll's, etc... I have now ported some to use the legacy dll directly through P/Invoke code.
When I look at resources regarding COM and P/Invoke, people almost always advice to use COM. Why is that? Doesn't P/Invoke have the following benefits:
- checked out code will always use the correct dll‘s instead of the last registered COM
- Multiple versions can run side by side on the servers (for instance: DEV, TEST and QA)
- No more COM registrations hassle
- Much faster than COM communication (articles I read indicate a 30% speed increase)