We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8dd4e61 commit ebe660fCopy full SHA for ebe660f
lib/truffle/truffle/ffi_backend/struct_layout.rb
@@ -159,6 +159,20 @@ def get(struct_pointer)
159
FFI::Struct::InlineArray.new(struct_pointer, self)
160
end
161
162
+
163
+ def put(struct_pointer, value)
164
+ if @type.char_array?
165
+ if value.bytesize < @type.length
166
+ struct_pointer.put_string(@offset, value)
167
+ elsif value.bytesize == @type.length
168
+ struct_pointer.put_bytes(@offset, value)
169
+ else
170
+ raise IndexError, "String is longer (#{value.bytesize} bytes) than the char array (#{@type.length} bytes)"
171
+ end
172
173
+ raise NotImplementedError, 'cannot set array field'
174
175
176
177
178
0 commit comments