Thread: Recommended Book on COM :: C++

  1. #16
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    In a short paragraph, what are the differences between COM and COM+. Why is COM+ so much better than COM?
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

  2. #17
    Registered User
    Join Date
    Oct 2002
    Posts
    5
    Since MS is only supporting DCOM in .NET for backward compatibility, so what is then used to do the distributed programming or what is the equivalent of CORBA?

  3. #18
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Davros: I mentioned your thoughts on COM and its future at MSDN Newsgroups (microsoft.public.vc.atl). Here are two interesting responses.

    Mike Weiss wrote:

    Davros, much like his Doctor Who namesake, is way off on a few of points the makes... or a bit misleading...

    First in one of his posts he describes a series of problems with sharing objects/classes between applications... almost all of the problems he talks about (things not being compatible, etc...) are NOT problems of COM, but are things COM solves. This *is* what he is saying, but I found it a bit confusing separating his description of the problems COM solves with the problems he has with COM itself.

    Also he claims the Microsoft doesn't call their binary COM files DLLs, which is untrue for most cases (a few years ago certain classes of COM objects were often giving the OCX extension, but that wasn't required). Also he claims one DLL can only contain one object, that's not true at all, they can contain many objects. Many of the frameworks/wizards/templates for building COM objects (VB, MFC, ATL) may make it seem like this is the case,
    but it's not.


    unch wrote:

    Davro seems to have misunderstood what problem space COM is designed to solve, it is a framework for communicating between binary executables. It therefore has very specific rules that your code has to implement. Virtual functions etc, are ideas for dealing with sharing "precompiled" (in-house) code, and are, normally, used extensively in implementing your custom COM object. COM supports specific datatypes so there is no confusion when you try to use a COM object from some other binary no matter what complier/platform, i.e. VT_UI2 (2-byte integer), VT_UI4 (4-byte integer).


    -----


    In my original message, I did not include a question on the order at which to learn and even become proficient with COM design and implementation using C++.

    What is the order in terms of books to study for learning and become proficient with COM design and implementating using C++? In other words, do you learn ATL first, or COM?

    Thanks,
    Kuphryn

  4. #19
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    Hey thanks. I'm genuinely interested to hear feedback. Here are my comments.

    >Davro seems to have misunderstood what problem space COM is designed to solve, it is a framework for communicating between binary executables.

    I haven't misunderstood anything of the sort. I know COM is a framework for communicating between binaries. I also know that it is technically challenging to export objects from binaries & this isn't Microsoft's fault. I know that COM is an attempt to overcome these challenges.

    >Davros, much like his Doctor Who namesake, is way off on a few of points the makes

    Well what are they?

    Microsoft used call their COM binaries OCX, but now call them DLLs. Well I'm glad to hear it. Didn't they used to call them OLEs in the early days as well. I think I can be forgiven for getting that one wrong.

    A COM DLL can contain more than one object, whereas I said it could only contain one. OK, I was wrong on this. Are these the only two minor things I was mistaken about?

    May be my gripe isn't with the technical people of M$. May be it's more with the M$ marketing department. My point was this.

    COM is based on the use of pure virtual method base classes. This is a long standing approach and you don't need COM to implement it. I don't think many people realise this, but that's not surprising given all the smoke put out by M$. It was quite revelation to me.

    I recall that I said M$ is only supporting COM in .NET for backward compatibility. Can someone either confirm or deny this? There's one guy saying that .NET is really the next iteration of COM. Another saying .NET doesn't support COM at all, but only supports DCOM. And now there's this thing called COM+, which nobody seems to know anything about.

    So tell me, who is confused?

  5. #20
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Good points.

    History has shown we are and will alway be in for a ride of new technology when we rely on Microsoft. I believe emphasizing C++ knowledge and experience should always be top priority.

    Nonetheless, I do want to learn COM and see why it is difficult.

    Kuphryn

  6. #21
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    Here's another question I have about COM?

    Imagine I have an application which use two objects of class A & B contained in two seperate COM DLLs. When the application runs, it therefore loads DLLs A & B. Now in the private implementation of class A, use is also made of class B. Therefore class A needs access to DLL B.

    Does this mean that DLL B is loaded twice into seperate address spaces? Once by my application, and once by DLL A?

    Or is there some kind of DLL handle pass-through?

  7. #22
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    LoadLibrary can be called multiple times without loading the code again. don't worry about that.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  8. #23
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by Davros
    Here's another question I have about COM?

    Imagine I have an application which use two objects of class A & B contained in two seperate COM DLLs. When the application runs, it therefore loads DLLs A & B. Now in the private implementation of class A, use is also made of class B. Therefore class A needs access to DLL B.

    Does this mean that DLL B is loaded twice into seperate address spaces? Once by my application, and once by DLL A?

    Or is there some kind of DLL handle pass-through?
    Not sure about the COM aspect, but FYB is right....if a dll is loaded more than once, it is mapped only once and each successive call returns the same HINSTANCE/HMODULE (which is nothing more than a pointer to the start of the mapped dll in memory)

    Look at your avarage Win32 App through a dependance walker; Shell32, GDI32 and User32 all map in Kernel32, which in turn mapps NTDLL.....if these dll werent mapped only once then much of the address space would be lost to dlls

  9. #24
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    Thanks. So any DLL can be loaded only once per process. No matter how many times LoadLibrary is called? I didn't know that, but it makes good sense.

  10. #25
    Shadow12345
    Guest
    I've read this entire post plus what davros wrote in that text file. To tell you the truth this all hurts my brain. Someone should point me to a good site with a lot of information explaining more in depth what com is and gives more examples of how it and its different flavors is used. MSDN doesn't exacly say what it is, it just has articles on how to use it.
    EDIT:
    I am reading MSDN anyway, it seems to be helpful, but I still want some other good resources that someone knows of. I don't want just some googler i want some special resource! I will go googling after I am finished with MSDN.

  11. #26
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    >MSDN doesn't exacly say what it is, it just has articles on how to use it

    I am vindicated!

    I have never found a website which just explains what COM is, other than to say it's a framework for communicating between binaries in an object orient way. There must be some somewhere and maybe someone can suggest a few; I'll be interested to see them also.

    If you like, we'll go through [generic] things such as objects in binaries, IDLs etc. That way you can build up an understanding of why, as well as how. I promise I'll try my best not to flame M$. That Bill Gates really... mmppfff.


    Tell me, are you familiar with creating DLLs?

  12. #27
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    it is very difficult to find any real documentation on the internet for COM. I don't know why that is. But get one of the books that has been mentioned and you'll start to understand what they're doing. It may take several readings of the early chapters (it did for me) but you can come out of this with an appreciation for COM/ActiveX. can't help more than that.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  13. #28
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Okay. Thanks.

    I understand COM fundamental concept via Jeff Prosise' book on MFC. Nonetheless, I would like to implement COM using pure C++ and eventually ATL.

    Kuphryn

  14. #29
    Shadow12345
    Guest
    by davros:
    Tell me, are you familiar with creating DLLs?
    If you were replying to my post, no I am not familiar with actually creating dlls (I've made one that exported a simple function that outputted text to the screen) but I think I understand what they are for. Correct me where I am wrong:
    Dynamic Link LIbraries are used for multiple clients to use at the same time. This means the same copy of the same library can get called upon by many clients. DLLs are good because it saves on memory usage.

    My understaning of COM so far is that it sort of like OO DLLS, meaning it containts the interface for all of the types that will be used, and those types are exported to programs to be used. Instead of exporting methods you export classes which contain all their functionality.

    by davros:
    That way you can build up an understanding of why, as well as how. I promise I'll try my best not to flame M$. That Bill Gates really... mmppfff.
    Okay well that is what I have been able to gather from the readings. I am probably off on parts, but I hope you guys will help clarify.

  15. #30
    Shadow12345
    Guest
    EDIT:
    This is off topic, but considering you guys are reading this post, and you know everything, it seems like a good place to ask:
    What is the Active Template Library(ATL). Is this like the next iteration of the Standard Template Library(STL)? Does it tie into COM in any fundamental way?

    ATL = STL++; //?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Recommended C#/.NET Book
    By kuphryn in forum C# Programming
    Replies: 4
    Last Post: 04-23-2004, 09:21 AM
  2. Books on C and C++
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-28-2002, 04:18 PM
  3. Recommended book for DirectX?
    By Dual-Catfish in forum Game Programming
    Replies: 3
    Last Post: 05-26-2002, 10:23 PM
  4. any recommended exercise book for C++?
    By gogo in forum C++ Programming
    Replies: 5
    Last Post: 11-07-2001, 04:44 PM