Skip to content

Commit

Permalink
Add additional fix for helicsQueryBufferFill()
Browse files Browse the repository at this point in the history
Gotta handle strings and pointers properly.
  • Loading branch information
trevorhardy committed Feb 2, 2024
1 parent 4172f01 commit bb8f737
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion helics/capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9367,7 +9367,8 @@ def helicsQueryBufferFill(buffer: HelicsQueryBuffer, string: str):
"""
f = loadSym("helicsQueryBufferFill")
err = helicsErrorInitialize()
f(buffer.handle, string, len(string), err)
str_ptr = ffi.new('char[]', string.encode('utf-8'))
f(buffer.handle, str_ptr, len(string), err)
if err.error_code != 0:
raise HelicsException("[" + str(err.error_code) + "] " + ffi.string(err.message).decode())

Expand Down

0 comments on commit bb8f737

Please sign in to comment.