Skip to content

Fix delegate return type: byte* instead of string for const char*#336

Merged
Ruslan-B merged 1 commit intomainfrom
fix/delegate-return-types
Mar 14, 2026
Merged

Fix delegate return type: byte* instead of string for const char*#336
Ruslan-B merged 1 commit intomainfrom
fix/delegate-return-types

Conversation

@Ruslan-B
Copy link
Copy Markdown
Owner

Summary

  • Fix delegate (function pointer) return types in the code generator
  • Delegates like AVClass_item_name now correctly return byte* instead of string for const char* C functions
  • String marshaling does not work with unmanaged function pointers, causing AccessViolationException

Fixes #271

Test plan

  • Generator runs without errors
  • Build succeeds (0 warnings, 0 errors)
  • All 17 tests pass
  • Example project runs successfully (decode + encode)

Fixes #271 - Delegates (function pointers in structs like AVClass.item_name)
incorrectly used string return type for const char*. String marshaling does
not work with unmanaged function pointers, causing AccessViolationException.

Changed generator to emit byte* for delegate return types when the C
function returns const char*.
@Ruslan-B Ruslan-B merged commit 8003b88 into main Mar 14, 2026
@Ruslan-B Ruslan-B deleted the fix/delegate-return-types branch March 14, 2026 11:42
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.

Invalid generated delegate AVClass_item_name (returns string instead of byte*)

1 participant