On Feb 12, 2008 10:48 PM, Thomas Heller <[EMAIL PROTECTED]> wrote: > Roman Yakovenko schrieb: > > Hi. > > > > I looked on generated code for msdia71.dll and this is what I found: > > > > # values for enumeration 'SymTagEnum' > > ... > > SymTagEnum = 12 > > ... > > SymTagEnum = c_int # enum > > > > I guess there is a mistake here. > > > > Well, yes. I always has the desire to define a proper enum type for ctypes, > but it will probably break too much code (and I haven't yet encountered an > enum type that has the same type name as one of its values). > > What I imagined was something like this: > > class SymTagEnum(c_enum): > SymTagNull = 0 > SymTagExe = 1 > SymTagCompiland = 2 > SymTagCompilandDetails = 3 > SymTagCompilandEnv = 4 > SymTagFunction = 5 > SymTagBlock = 6 > ... > > but of course this would add another namespace to access the enum values.
This is not as bad as you think about it. It will follow pretty close C++ examples/usage. This is the code I wrote using C++/CLI: void print_namespaces( Dia2Lib::IDiaSymbol^ smb, System::String^ offset ){ System::String ^name; Dia2Lib::IDiaEnumSymbols^ symbols; smb->findChildren(Dia2Lib::SymTagEnum::SymTagUDT,name,0,symbols); for( int i = 0; i < symbols->count; ++i ){ Dia2Lib::IDiaSymbol^ internal_smb = symbols->Item(i); System::Console::WriteLine( offset + internal_smb->name ); print_namespaces( internal_smb, offset + " " ); } } > I'll change the codegenerator to emit correct code; in the meantime you > could fix the generated module manually by commenting out the last > 'SymTagEnum = c_int' line, and replace all later occurrences of 'SymTagEnum' > in the file with 'c_int'. It is not a problem at all. I can define SymTagEnum in my code and to use it. Thanks for help. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ comtypes-users mailing list comtypes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/comtypes-users