Menu

#119 Allow multiple type libraries

open
nobody
None
5
2012-04-20
2012-04-20
YanXu
No

As explained in my post to the python-win32 mailing list ("How to write a COM Server implementing interfaces from type lib?"), I have patched the policy.py to support multiple type libraries.

This should work in parralel to the exisisting one-type-lib feature. Using the changed version, a new attribute can be used in the COM implementation class called "_typelib_interfaces_". This attributes is expected to be a list tuplse of the library CLSID string, the major and minor version, the LCID and a list of Interface strings.

Here is an example I used in my server:

class OPCServer():

(...some other attributes...)

_typelib_interfaces_ = [
("{3B540B51-0378-4551-ADCC-EA9B104302BF}", 3, 0, 0,
[
'IOPCServer',
'IOPCItemProperties',
]
),
("{B28EEDB1-AC6F-11D1-84D5-00608CB8A7E9}", 1, 0, 0,
[
'IOPCCommon',
'IConnectionPointContainer'
]
)
]

Actually, the patch includes some comment that say "PATCH START".

Discussion

  • YanXu

    YanXu - 2012-04-20

    Patch of policy.py

     
  • Mark Hammond

    Mark Hammond - 2012-11-24

    I'm very sorry for the delay in looking at this.

    Wouldn't it be possible to implement this by just allowing a new, say _typelibs_ attribute, which is a list of (guid, major_ver, minor_ver) tuples, then have _build_typeinfos_ search all specified typelibs for the interfaces? It seems like that would make for a less-intrusive patch and allow us to deprecate _typelib_guid_ and _typelib_version_ for _typelibs_.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.