/* * * Private Sub AddHelperTypes(ByVal col As CodeTypeDeclarationCollection) * Dim addPInvokePointer As Boolean = False * Dim it As New CodeDomIterator() * Dim list As List(Of Object) = it.Iterate(col) * For Each obj As Object In list * Dim ctdRef As CodeTypeReference = TryCast(obj, CodeTypeReference) * If ctdRef IsNot Nothing AndAlso 0 = String.CompareOrdinal(ctdRef.BaseType, MarshalTypeFactory.PInvokePointerTypeName) Then * addPInvokePointer = True * End If * Next * * If addPInvokePointer Then * col.Add(MarshalTypeFactory.CreatePInvokePointerType()) * End If * End Sub */ /// <summary> /// Make sure that any NativeDefinedType referenced is in the bag. That way if we /// have structures which point to other NativeDefinedType instances, they are automagically /// put into the bag /// </summary> private void ChaseReferencedDefinedTypes(NativeSymbolBag bag) { bag.TryResolveSymbolsAndValues(); foreach (var sym in bag.FindAllReachableNativeSymbols()) { if (sym.Category == NativeSymbolCategory.Defined) { NativeDefinedType defined = null; if (!bag.TryFindDefined(sym.Name, out defined)) { bag.AddDefinedType((NativeDefinedType)sym); } } } }