SourceForge has been redesigned. Learn more.

#119 Allow multiple type libraries


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 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,
("{B28EEDB1-AC6F-11D1-84D5-00608CB8A7E9}", 1, 0, 0,

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


  • YanXu

    YanXu - 2012-04-20

    Patch of

  • 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.