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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:11:40+00:00 2026-06-15T17:11:40+00:00

I have many projects of which generate COM DLL’s, these projects output the following:

  • 0

I have many projects of which generate COM DLL’s, these projects output the following:

projectname_i.h
projectname_i.c
projectname_p.c
projectname_i.tlb

Then where another project consumes this DLL it is used like so:

#import "projectname.tlb" named_guids no_namespace

I want to change this to use include instead of import.

The reason behind wanting to change from #import to #include is because I want to enable the /MP compiler switch to speed up build times.

http://msdn.microsoft.com/en-us/library/bb385193.aspx

So what I would like to know is:

  • Why do COM DLLs have a TLB and a H?
  • Which should be used and why?
  • What is the difference between using #include vs #import? will there be any unforeseen consequences from switching to #include?
  • 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-15T17:11:41+00:00Added an answer on June 15, 2026 at 5:11 pm

    Why do COM DLLs have a TLB and a H?

    The generated _i.h file contains the declarations you wrote in the IDL file in a format that’s usable by a C or c++ compiler. The .tlb file is a type library, it contains the IDL declarations in a format that’s usable by any language that supports COM. It gets embedded in the COM server DLL as a resource. Whomever uses your COM server will need it. If you don’t build the proxy/stub DLL then it may also be needed at runtime to marshal calls across apartments.

    What is the difference between using #include vs #import?

    As long as the client is written in C or C++, #including the _i.h file is enough to get the necessary declarations to use the server. Do note however that the #import directive does more, it auto-generates a .tlh and a .tli file that get #included in the client code. These files declare smart pointer types for the interfaces in the COM server, types that make it a lot easier to use the server. Open these files in a text editor to see what they contain. If your client code uses the XxxxPtr types or catches the _com_error exceptions that are auto-generated from error return codes then you are looking at a very substantial rewrite of the client code if you don’t want to use the #import directive.

    If the COM server is stable and its interface declarations are not going to change anymore then you could check-in the .tlh and .tli files and replace the #import by two #includes for these files. Be sure to leave a comment in the code that shows a maintainer how to re-generate the files, “never change” is an elusive goal. And, of course, this trick isn’t appropriate if you try to make /MP effective, that indicates that the COM server is still changing.

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

Sidebar

Related Questions

I have a solution which has many projects inside it. I build the solution
I have a VS 2012 solution which has many class projects inside it. Now
I have many projects which inherit from a parent pom. I enable Cobertura coverage
I'm working on a large project (for me) which will have many classes and
ok i have a project which has many gridview in its pages... now i
I have a WCF visual studio project, which contains many SVC files. Can I
I'm working on a web project, which have to process so many client requests.
We have many projects with several files inside each. Files can be checked in
I have worked many projects with no problems. But in current project, I tested
I have MANY small Test Projects where I put together just enough code to

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.