Skip to content

Wrap the object-file, binary, and memory-buffer reading surface on the Layer-2 typed handles#267

Merged
tannergooding merged 3 commits into
dotnet:mainfrom
tannergooding:tannergooding-interop-object-file-reading
Jul 16, 2026
Merged

Wrap the object-file, binary, and memory-buffer reading surface on the Layer-2 typed handles#267
tannergooding merged 3 commits into
dotnet:mainfrom
tannergooding:tannergooding-interop-object-file-reading

Conversation

@tannergooding

Copy link
Copy Markdown
Member

Wraps the object-file / binary / memory-buffer reading surface (44 C-API functions) on their typed-handle structs so this can be driven from the middle layer without dropping to the generated LLVM.* P/Invokes.

  • LLVMMemoryBufferRef (+IDisposable): BufferSize/BufferStart; CreateWithContentsOfFile/MemoryRange/MemoryRangeCopy/STDIN + Try* variants.
  • LLVMBinaryRef (+IDisposable): Create/TryCreate, BinaryType, CopyMemoryBuffer, Mach-O universal CopyObjectForArch, section/symbol iterators.
  • LLVMObjectFileRef, LLVMSectionIteratorRef, LLVMSymbolIteratorRef, LLVMRelocationIteratorRef (+IDisposable): section/symbol/relocation iteration and their accessors.

Owned char* error out-params are copied then freed with LLVMDisposeMessage; const pointers into the object (Name/TypeName/ValueString) are read via SpanExtensions.AsString and not disposed.

Deliberately skipped the free-function bitcode parsers on LLVMMemoryBufferRef (ParseBitcode/GetBitcodeModule) — the context-based equivalents already exist on LLVMContextRef and adding the free-function variants would duplicate that path.

Interop-only; no generated-file edits. Builds clean (0 warnings), tests pass.

tannergooding and others added 3 commits July 15, 2026 17:56
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@tannergooding
tannergooding merged commit 7fc6069 into dotnet:main Jul 16, 2026
12 checks passed
@tannergooding
tannergooding deleted the tannergooding-interop-object-file-reading branch July 16, 2026 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant