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 532573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:25:09+00:00 2026-05-13T09:25:09+00:00

I know that COM provides reusability at the binary level across languages and applications.

  • 0

I know that COM provides reusability at the binary level across languages and applications.
I read that all components built for COM must adhere to a standard memory layout in order to be language-independent.

I do not understand what “standard memory layout” means.

What makes COM language-independent?

  • 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-13T09:25:09+00:00Added an answer on May 13, 2026 at 9:25 am

    First, some technical background: C++ compilers usually generate something called a “vtable” for any class with virtual functions. This is basically a table of function pointers. The vtable contains a function pointer to every virtual method implemented by a class.

    In COM, interfaces are basically abstract base classes which a component implements, e.g.:

    class CSomeComponent : IUnknown, ISomeOtherInterface  { ... };
    

    The vtable for CSomeComponent will include function pointers for all methods defined in these two interfaces.

    struct __imaginary_vtable_for_CSomeComponent
    {
        // methods required by IUnknown
        HRESULT (*QueryInterface)( const IID& iid, void** ppv );
        ULONG (*AddRef)();
        ULONG (*Release)();
        // methods required by ISomeOtherInterface
        void (*foo)();
        ...
    };
    

    Any instantiated object has a reference to the vtable of its dynamic type. This is how the program knows how to call the proper method in cases where a base method is overridden in a derived class:

    class Base
    {
    public:
        virtual void foo() { ... }
    }
    
    class Derived : public Base
    {
    public:
        virtual void foo() { ... }  // overrides Base::foo()
        virtual void bar() { ... }
    }
    
    ...
    
    Base* X = new Derived;
    X->foo();
    

    The last line should call Derived::foo. This works because object X has a reference to the vtable for class Derived. As said, the vtable is like a list of function pointers. Now, vtables have a fixed layout: If class Derived inherits from class Base, the function pointer for method foo will be at the same relative location in Derived‘s vtable than in Base‘s vtable:

    struct __imaginary_vtable_for_Base
    {
        void (*foo)();
    };
    
    // __imaginary_vtable_for_Base::foo = Base::foo
    
    struct __imaginary_vtable_for_Derived
    {
        void (*foo)();
        void (*bar)();
    };
    
    // __imaginary_vtable_for_Derived::foo = Derived::foo
    

    Now, if the compiler sees something like X->foo(), it knows that all for all classes derived from Base, method foo corresponds to the first entry in the vtable. So it issues a call to the first function pointer, which in X‘s case is a call to Derived::foo.

    Answer to your question: Compilers can only generate COM components if they generate the same layout for vtables that the COM specification demands. vtables can be implemented in various different ways, especially when it comes to multiple inheritance (which is required with COM components). Adhering to a certain vtable format is necessary so that when you call a component’s method f, you will actually call method f and not some other method g which happens to sit at f‘s position in the component class’s vtable. I suppose COM-compliant compilers essentially have to produce the same vtable layouts as Microsoft Visual C++, since the COM technology was defined by Microsoft.

    P.S.: Sorry for being so technical, I hope the above information is of some use to you.

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

Sidebar

Ask A Question

Stats

  • Questions 375k
  • Answers 375k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use the signature from CodeHaus: <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration>… May 14, 2026 at 8:14 pm
  • Editorial Team
    Editorial Team added an answer Create a protocol for your view controllers to conform to,… May 14, 2026 at 8:14 pm
  • Editorial Team
    Editorial Team added an answer Have you tried the development console? To access it, go… May 14, 2026 at 8:14 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.