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

  • Home
  • SEARCH
  • 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 4540092
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:02:18+00:00 2026-05-21T15:02:18+00:00

I am building a library which needs to be referenced from VBA so I

  • 0

I am building a library which needs to be referenced from VBA so I need to provide a type library to support early binding. Most of the examples I have seen define a interface for classes which are exposed to COM e.g.

[Guid("D6F88E95-8A27-4ae6-B6DE-0542A0FC7039")]     
[InterfaceType(ComInterfaceType.InterfaceIsDual)]     
public interface IMyClass 

[Guid("13FE32AD-4BF8-495f-AB4D-6C61BD463EA4")]     
[ClassInterface(ClassInterfaceType.None)]     
[ProgId("MyNamespace.MyClass")]     
public class MyClass : IMyClass

Is there any disadvantage in having a class implement the interface directly using ClassInterface.AutoDual? For more complex classes I like having interfaces to clearly define which members are exposed com without having to use the ComVisible attribute everywhere. But I will also have a number of fairly trivial data classes like event args which will be exposed to COM in their entirety. I have also seen examples which explicitly set dispids on interfaces – is there any advantage in doing this?

  • 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-05-21T15:02:18+00:00Added an answer on May 21, 2026 at 3:02 pm

    Yes, there’s a big one: DLL Hell is nasty with early binding. The COM client directly calls the method through the v-table pointer. If an outdated COM server that uses the same interface IIDs (which in itself is a crime) is resident then this may call a wrong or non-existing method. The runtime failure, usually an AccessViolation, is very hard to diagnose.

    This doesn’t happen with late binding, there will (usually) be a reasonable diagnostic, like DISP_E_MEMBERNOTFOUND or DISP_E_BADPARAMCOUNT. Which is why Microsoft heavily favors ComInterfaceType.InterfaceIsIDispatch. The disadvantage is that late binding is quite slow. Another one is that errors are only caught at runtime, not compile time.

    Setting the DispIDs is very rarely useful. Some legacy Microsoft products used dispid binding, pre-compiling the dispid into the code. It is roughly twice as fast as late binding because there’s no need for the IDispatch::GetIDsOfNames() call. It is very unlikely you’ll still encounter them in the wild, certainly not any VBA version.

    A decent KB article on the topic is here.

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

Sidebar

Related Questions

When building a multi-framework package for Nuget you need to divide up the library
I'm building up a library of filters for a validation class in PHP, some
I'm building a class library that will have some public & private methods. I
I'm building the world's simplest library application. All I want to be able to
Intel's Threading Building Blocks (TBB) open source library looks really interesting. Even though there's
I am building an application as a library, but to make sure I can
I am currently building a Neural Network library. I have constructed it as an
I am looking for an open source library in Java for parsing and building
Building on How Do You Express Binary Literals in Python , I was thinking
Building a client-side swing application what should be notified on a bus (application-wide message

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.