I was wondering what the best way way to handle dynamic string allocation is. I'm doing the below
char_callback :: proc "c" (window: glfw.WindowHandle, code: rune) {
term: ^Terminal = glfw.GetWindowUserPointer(window)
txt := term.lines[term.start].txt
term.lines[term.start].txt = strings.concatenate({txt[:term.cursor], code, txt[term.cursor:]})
// term.view_height = 0;
term.window = term.start
term.cursor += 1
}
But this doesn't work since there is no context allocator in a C calling convention. This is super easy to do in C++. I'm wondering why there is no stack allocated concatenation in Odin. (or maybe there is an I'm missing the point?)