Что такое токены метаданных в файлах obj? - PullRequest
0 голосов
/ 08 октября 2018

Я сталкивался с ошибкой компоновщика c ++ cli:

Ошибка Ошибка операции метаданных LNK2022 (80131195): пользовательские атрибуты не согласованы: (0x0c00019d).foo.obj 1

Ошибка Ошибка операции метаданных LNK2022 (80131195): Пользовательские атрибуты не согласованы: (0x0c0001ab).bar.obj 1

Что такое токены метаданных?Я изучил файлы obj через ildasm, но я понятия не имею, что на самом деле является проблемой.Вот краткое содержание:

foo.obj:

// TypeDef #190 (020000bf)
// -------------------------------------------------------
//  TypDefName: FooClass  (020000BF)
//  Flags     : [Public] [SequentialLayout] [Class] [Sealed] [AnsiClass] [BeforeFieldInit]  (00100109)
//  Extends   : 01000017 [TypeRef] System.ValueType
//  Layout    : Packing:0, Size:12
//  CustomAttribute #1 (0c00019c)
//  -------------------------------------------------------
//      CustomAttribute Type: 0a000006
//      CustomAttributeName: System.Runtime.CompilerServices.NativeCppClassAttribute :: instance void .ctor()
//      Length: 4
//      Value : 01 00 00 00                                      >                <
//      ctor args: ()
// 
//  CustomAttribute #2 (0c00019d)
//  -------------------------------------------------------
//      CustomAttribute Type: 0a000007
//      CustomAttributeName: System.CLSCompliantAttribute :: instance void .ctor(bool)
//      Length: 5
//      Value : 01 00 00 00 00                                   >                <
//      ctor args: ( <can not decode> )

bar.obj

// TypeDef #199 (020000c8)
// -------------------------------------------------------
//  TypDefName: FooClass  (020000C8)
//  Flags     : [Public] [SequentialLayout] [Class] [Sealed] [AnsiClass] [BeforeFieldInit]  (00100109)
//  Extends   : 01000016 [TypeRef] System.ValueType
//  Layout    : Packing:0, Size:12
//  CustomAttribute #1 (0c0001aa)
//  -------------------------------------------------------
//      CustomAttribute Type: 0a000006
//      CustomAttributeName: System.Runtime.CompilerServices.NativeCppClassAttribute :: instance void .ctor()
//      Length: 4
//      Value : 01 00 00 00                                      >                <
//      ctor args: ()
// 
//  CustomAttribute #2 (0c0001ab)
//  -------------------------------------------------------
//      CustomAttribute Type: 0a000007
//      CustomAttributeName: System.CLSCompliantAttribute :: instance void .ctor(bool)
//      Length: 5
//      Value : 01 00 00 00 00                                   >                <
//      ctor args: ( <can not decode> )

Все явидите, что FooClass расширяет различные ValueTypes (я не знаю почему).Есть ли документация об этих токенах?Это какая-то информация о символах в pdb?

...