Hi all,
As many of you probably know, we currently have no standard way for implementing COM objects in Wine. We use different techniques all over the place. Some of them are better, other are worse or even ugly. Together with Alexandre, we've chosen the technique that we believe is the best known ATM. I've described it on the wiki page:
http://wiki.winehq.org/COMGuideline
There is a janitorial task to change all our existing code to follow the guideline. Michael is going to use his scripting magics to do the work.
The plan is that all the new code should follow the guideline, so if you are touching COM stuff in Wine, please get familiar with it. Any comments are welcomed.
Cheers, Jacek
Hi all,
The code like static inline MyObject *impl_from_IMyInterface(IMyInterface *iface) { return (MyObject*)((char*)iface - FIELD_OFFSET(MyObject, IMyInterface_iface)); }
could be replaced with static inline MyObject *impl_from_IMyInterface(IMyInterface *iface) { return container_of(MyObject, IMyInterface_iface); }
Cheers, Alexander.
Hello,
Alexander Kochetkov wrote:
The code like static inline MyObject *impl_from_IMyInterface(IMyInterface *iface) { return (MyObject*)((char*)iface - FIELD_OFFSET(MyObject, IMyInterface_iface)); }
could be replaced with static inline MyObject *impl_from_IMyInterface(IMyInterface *iface) { return container_of(MyObject, IMyInterface_iface); }
container_of is Linux Kernel specific. But Windows has such a macro too called CONTAINING_RECORD().
bye michael