Skip to content

Support flags in Fiddle::MemoryView.new and .export - #209

Merged
kou merged 1 commit into
ruby:masterfrom
himura467:memory-view-flags
Jul 24, 2026
Merged

Support flags in Fiddle::MemoryView.new and .export#209
kou merged 1 commit into
ruby:masterfrom
himura467:memory-view-flags

Conversation

@himura467

@himura467himura467 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Accept an optional flags argument, expose the flag values as constants, and reject unsupported flags in Fiddle::Pointer's provider.

  • rake test

kou
kou approved these changes Jul 24, 2026

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment threadext/fiddle/memory_view.c Outdated
Comment on lines +328 to +336
rb_define_const(rb_cMemoryView, "SIMPLE", INT2NUM(RUBY_MEMORY_VIEW_SIMPLE));
rb_define_const(rb_cMemoryView, "WRITABLE", INT2NUM(RUBY_MEMORY_VIEW_WRITABLE));
rb_define_const(rb_cMemoryView, "FORMAT", INT2NUM(RUBY_MEMORY_VIEW_FORMAT));
rb_define_const(rb_cMemoryView, "MULTI_DIMENSIONAL", INT2NUM(RUBY_MEMORY_VIEW_MULTI_DIMENSIONAL));
rb_define_const(rb_cMemoryView, "STRIDES", INT2NUM(RUBY_MEMORY_VIEW_STRIDES));
rb_define_const(rb_cMemoryView, "ROW_MAJOR", INT2NUM(RUBY_MEMORY_VIEW_ROW_MAJOR));
rb_define_const(rb_cMemoryView, "COLUMN_MAJOR", INT2NUM(RUBY_MEMORY_VIEW_COLUMN_MAJOR));
rb_define_const(rb_cMemoryView, "ANY_CONTIGUOUS", INT2NUM(RUBY_MEMORY_VIEW_ANY_CONTIGUOUS));
rb_define_const(rb_cMemoryView, "INDIRECT", INT2NUM(RUBY_MEMORY_VIEW_INDIRECT));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move rb_define_const()s between rb_define_alloc_func() and rb_define_singleton_method()?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied.

@kou

kou commented Jul 24, 2026

Copy link
Copy Markdown
Member

Could you resolve conflicts?

Accept an optional `flags` argument, expose the flag values as constants, and reject unsupported flags in `Fiddle::Pointer`'s provider.
@himura467

Copy link
Copy Markdown
ContributorAuthor

@kou
Resolved!

@kou
kou merged commit 8dc7c05 into ruby:masterJul 24, 2026
67 checks passed
@kou

kou commented Jul 24, 2026

Copy link
Copy Markdown
Member

Thanks.

@himura467
himura467 deleted the memory-view-flags branch July 24, 2026 07:54
Sign up for freeto 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.

2 participants

@himura467@kou