Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1017 (reopened defect)

Opened 5 months ago

Last modified 4 weeks ago

tango.sys.win32.IUnknown: IUnknown should be an interface, not a class

Reported by: JarrettBillingsley Assigned to: sean
Priority: normal Milestone: 0.99.8
Component: Tango Version: 0.99.5 Jascha
Keywords: triage Cc:

Description

If IUnknown is a class, it makes it simply impossible to declare other Windows interfaces which inherit from IUnknown (which is, well, all of them). IUnknown should be an interface, and default implementations for the methods of it should be provided either as a template mixin or as an adapter class (or both!).

Change History

04/03/08 23:41:40 changed by kris

  • owner changed from kris to sean.

tricky, since there's implementation in there (which also means it should not have an 'I' prefix). Reassigning to Sean

04/04/08 14:25:46 changed by sean

  • status changed from new to closed.
  • resolution set to wontfix.

I'm not sure there's anything we can do about this. As far as I know, there is special code for handling IUnknown in the compiler. Tango's version of IUnknown is a carbon copy of the one in Phobos for this reason. That said, if you want to try it out and it works, let me know and I'll consider changing it on our end. My experience with COM is practically nil.

04/05/08 07:33:02 changed by larsivi

I was told (haven't checked) that IUnknown is an interface in Phobos, but is implemented by ComObject?

04/05/08 14:16:19 changed by kris

that would make a lot more sense :)

04/27/08 03:58:02 changed by larsivi

  • status changed from closed to reopened.
  • resolution deleted.
  • milestone changed from 0.99.6 to 0.99.7.

05/24/08 14:44:08 changed by larsivi

  • keywords set to triage.

07/10/08 06:54:49 changed by larsivi

  • milestone changed from 0.99.7 to 0.99.8.

07/26/08 15:37:24 changed by sean

  • status changed from reopened to closed.
  • resolution set to wontfix.

I just checked and IUnknown is a class in Phobos, so I'll assume there's a reason for it.

08/12/08 15:35:23 changed by JarrettBillingsley

  • status changed from closed to reopened.
  • resolution deleted.

No, std.windows.iunknown is not the right thing, in fact I'm not sure what the hell that file is for. It's in std.c.windows.com. IUnknown is an interface, which ComObject? implements.

Please, this is the correct way to do it. Having IUnknown as a class makes it impossible to declare COM interfaces, which is a pretty big shortcoming.

08/12/08 15:37:01 changed by JarrettBillingsley

And also -- how can IUnknown be a class? D classes do not support COM; D interfaces do. IUnknown must be implemented as an interface for it to function properly.