Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Can non-COM DLLs utilize embeded typelibs for use when importing?

Posted on 2004-10-26
6
Medium Priority
?
198 Views
Last Modified: 2010-05-18
Is it possible to write a non-COM DLL and embeded a type-library like in COM DLLs. It would be nice to distribute a DLL and any developer can use the #import directive and have Visual Studio generate the header files for them from the typelib.

I could have swore I saw this done before, but a colleauge says it is only done for COM DLLs.

Thanks.
0
Comment
Question by:code_snake
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 12413445
Well, yes and no. As soon as you can embed and read a typelib, the DLL *is* COM, since it implements ITypeInfo...
0
 

Author Comment

by:code_snake
ID: 12413535
Interesting. That may be acceptable since that COM feature would only be used for development.

The question is then how does Visual Studio C++ treat the DLL then. Since it is using the ITypeInfo interface it probably does not understand that the DLL does not implement IUnknown or any subinterfaces. In addition, I would guess it can't understand that interfaces that are defined in the typelib are not COM, and need to be called directly on the DLL not through COM.

So it sounds like the the answer is no, is is not possible.
0
 
LVL 9

Accepted Solution

by:
_ys_ earned 1000 total points
ID: 12461380
COM DLLs have the option to embed typelibs. Non COM DLLs have this option as well - and it doesn't require ITypeInfo, or any other COM interfaces to be used.

Embedding typelib information into a dll simply requires an extra resource to be added to the DLL. The resouce being the typelib itself. COM is not requried in order to do this, or extract it - it's simply another resource.

Instructions on how to embed a type library into a DLL as a resource can be found in my posts here:
http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20891459.html
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question