The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

How to I "inherit" an interface?

I've got my COM code working thanks to earlier assistance on this forum.  Thanks to all...

Now I would like to use my functioning interface in a new interface through inheritance, but I'm getting MIDL errors I cannot track down.

My structure looks like this (boring details omitted):

library DumontDSO
{
  importlib("stdole2.tlb")
  [ uuid(bla-bla-bla)
    dual
    oleautomation
  ]
  interface IDumontDataSet: IDispatch
  {
    and so on...
  };

Now, in a new file I would like to do the following:

library DumontDSC
{
  importlib("IDumontDSO.tlb")
  [ uuid(bla-bla-bla)
    dual
    automation
  ]
  interface IDumontDataSetChange: IDumontDataSet
  {
    and so on...
  };


The interface DumontDataSetChange takes on all the properties and methods of the DumontDataSet, and then of course I want to override some of those virtual interface functions (adding functionality like normal c++).

This is trivial for me in C++, I just do not understand MIDL as it pertains to inheritance and googling these error messages didn't yeild much.

If someone can assist or point me to a decent primer or something I would be most thankful.
Mark Petryk Send private email
Tuesday, January 09, 2007
 
 
Hi Mark,

It's been a while since I did COM work, but one of the things I remember is that when numbering the methods in the child interface, the numbers cannot duplicate any used in the base interface.  If your base interface has methods numbered 1 - 4, start numbering your child interface at 5.

As I recall, the MIDL compiler did not do a good job of flagging errors and if the MIDL compiler fails, it leaves the old compiled MIDL in place and lets the rest of the buidl run.  Always do a rebuild all after a MIDL change to make sure your MIDL compiles, otherwise you can get some very strange results in what looks like a clean build.

Good luck.
Wayne M.
Tuesday, January 09, 2007
 
 
Yup, that seemed to take care of the error.  Thank you.
Mark Petryk Send private email
Tuesday, January 09, 2007
 
 
The best book I read in COM is "COM and ATL 3.0" by Troelsen... That helped for a while.

But nowadays we have a new "mountain": COM-Managed Interop...
Ari Telias Send private email
Tuesday, January 09, 2007
 
 
"...and then of course I want to override ***some*** of those virtual interface functions..."

I hope you understand that you are doing interface inheritance and not implementation inheritance. You will have to implement *ALL* of the methods.

Anyway, what is the error you are getting and what version of VC++ are you using?
Ragi Burhum
Wednesday, January 10, 2007
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz