Nested structures in Ruby Fiddle

How about: data.c #include <stdio.h> struct A { int a_id; }; struct B { int b_id; struct A a_nested; }; void dump_b(struct B* b) { printf(“B.b_id: %d\n”, b->b_id); printf(“B.a_nested.a_id: %d\n”, b->a_nested.a_id); } fiddle.rb # frozen_string_literal: true require ‘fiddle’ require ‘fiddle/import’ module Test extend Fiddle::Importer dlload ‘./data.dylib’ B = struct [ “int id”, “int a_id” ] … Read more

tech