enthought / comtypes

A pure Python, lightweight COM client and server framework, based on the ctypes Python FFI package.
Other
290 stars 97 forks source link

Define constants and `c_int` aliases earlier than others in wrapper modules #527

Closed junkmd closed 5 months ago

junkmd commented 5 months ago

I have noticed something while fixing the bug reported in #524.

In the wrapper module, members of an enumeration are defined as module-level constants. If they have the same name as a previously defined interface or CoClass, it will overwrite the definition.

The order of type information parsed from the COM library is optimized for the environment, so it is not always fixed. In other words, symbols with duplicate names cannot be identified as to what type or value they are until the module is generated.

To ensure that the values of constants do not overwrite interfaces or CoClasses, codegenerator generates the codebase that defines the constants before them.

junkmd commented 5 months ago

CIs are passed. https://github.com/enthought/comtypes/actions/runs/8687275606 https://ci.appveyor.com/project/pywinauto/pywinauto/builds/49616197