feat: expose TypeLibrary Duplicate/Register/RemoveNamed*/LookupByGuid#35
Merged
Conversation
Closes HIGH missing-capi gap #19. The binding declared the five P/Invokes (BNDuplicateTypeLibrary, BNRegisterTypeLibrary, BNRemoveTypeLibraryNamedObject, BNRemoveTypeLibraryNamedType, BNLookupTypeLibraryByGuid) but exposed no managed wrappers, so the TypeLibrary lifecycle and named-store mutation surface was incomplete vs Python (typelibrary.py duplicate/register/remove_named_object/ remove_named_type/lookup_by_guid). Add: - TypeLibrary.Duplicate() (fresh-GUID copy), - TypeLibrary.Register() (method form of Python's register property), - TypeLibrary.RemoveNamedObject(QualifiedName) / RemoveNamedType, pinning the BNQualifiedName via ScopedAllocator.AllocStruct because the Remove P/Invokes take BNQualifiedName* (a pointer) whereas Add takes it by reference, - static TypeLibrary.LookupByGuid(Architecture, string).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes HIGH-severity missing-capi gap #19. Five
TypeLibraryP/Invokes were declared but had no managed wrappers, leaving the lifecycle and named-store mutation surface incomplete vs Python.Duplicate()BNDuplicateTypeLibraryduplicate(typelibrary.py:142)Register()BNRegisterTypeLibraryregister(typelibrary.py:244)RemoveNamedObject(QualifiedName)BNRemoveTypeLibraryNamedObjectremove_named_object(typelibrary.py:383)RemoveNamedType(QualifiedName)BNRemoveTypeLibraryNamedTyperemove_named_type(typelibrary.py:416)static LookupByGuid(Architecture, string)BNLookupTypeLibraryByGuidlookup_by_guidNotes
Registeris avoidmethod (Python oddly exposes it as a@propertyreturningNone; C# can't have a void-returning property, so a method is the correct translation).BNQualifiedName*(anIntPtr), unlikeAdd*which take it by reference (in BNQualifiedName) — an inconsistency from auto-generation. The wrappers pin the converted struct viaScopedAllocator.AllocStructrather than editing the generated P/Invoke files.E2E tests (harness repo)
TypeLibraryMissingWrapperTests(4 tests, all 5 wrappers covered):DuplicateReturnsIndependentInstanceWithFreshGuid— distinct handle, same name, fresh GUID.RegisterThenLookupByGuidFindsLibrary— round-trips Register + LookupByGuid.AddThenRemoveNamedTypeRoundTrips/AddThenRemoveNamedObjectRoundTrips— add → GetNamed* non-null → remove → null.Full harness regression 56/56.