Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8057301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:59:24+00:00 2026-06-05T08:59:24+00:00

In our project we are reusing lot’s of Delphi code through COM in our

  • 0

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)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:59:25+00:00Added an answer on June 5, 2026 at 8:59 am

    PInvoke is a very nice tool, but it certainly is no substitute for COM. PInvoke only supports simple functions with a C syntax; COM lets you implement an object model. Take the classes in the Microsoft.Office.Interop namespaces for example – they are all pure COM classes with no wrappers. Doing Office interop with PInvoke would be excruciatingly painful.

    Another core problem with PInvoke is that it is typically the burden of the client programmer – the person least likely to get them right – to write the declarations. A COM author can publish an auto-generated type library, much like metadata in a .NET assembly, drastically eliminating the odds for mistakes and no work needed by the client programmer beyond Project > Add Reference.

    Addressing your bullets:

    • checked out code will always use the correct DLLs instead of the last registered COM
      You are still subject to the vagaries of Windows finding the proper DLL. The only good way to avoid accidents is to store the DLL in the same directory as the EXE, which is quite possible in COM as well; all you have to do is create an empty file with the name yourapp.exe.local

    • Multiple versions can run side by side on the servers (for instance: DEV, TEST and QA)
      Not a problem in COM either, using the above technique or by using a reg-free manifest.

    • No more COM registrations hassle
      Use a reg-free manifest so no registration is required. Very simple to do – just set the Isolated property of the reference to True.

    • Much faster than COM communication (articles I read indicate a 30% speed increase)
      It is much slower than COM. You can incur an extra cost by making late-bound COM calls through IDispatch; that’s roughly as expensive as using Reflection to make the call.


    There’s a third way to do native code interop: writing a managed class wrapper in the C++/CLI language. The technique heavily used in the .NET framework, particularly in mscorlib.dll, System.Data and PresentationFramework, assemblies that have strong dependencies on native code. Not, however, very suitable for Delphi; it works best for native code that can easily be called from C or C++.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our project represents a web application on ASP.NET MVC base. It has a lot
In our ASP.Net web project we seem to have some .refresh files associated with
Our project constitutes of many modules (e.g. a HR management system containing modules like
Our project uses an LDAP repository for storing users. In production this will be
In our project, we'd like to have our TFS build put each project into
Our project has about 20 developers, but our application makes relatively light use of
We have the following scenario with our project: A core web application packaged as
I've read a lot of discussions about web site vs web applications in asp.net
So while we're using foreign keys in our current project, I've heard the argument
Our project currently uses Crystal Reports for Visual Studio 2008. We need to upgrade

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.