Odin terminates as soon as I'm trying to do allocations in a callback proc when in interop with a C library. Without giving further info.
It is simple as make([]byte, 128) or fmt.tprint calls that terminate the program.
Unfortunately, I had a dead end on this a few months ago and gave up on it.
Now, trying to look into it again its stil that Odin seems like a offended little bitch not telling me anything.
(No offense meant)
Step by step repro, creating a tiny project (tested on Gnu/Linux):
odin_gui_proj
├── webui
│ └── ...
└── main.odin
git init odin_gui_proj && cd odin_gui_proj
git submodule add https://github.com/webui-dev/odin-webui.git webui
webui/setup.sh
package main
import "core:fmt"
import "core:strconv"
import "core:strings"
import ui "webui"
DOC :: `<!DOCTYPE html>
<html>
<head>
<script src="webui.js"></script>
<style>
body {
background: linear-gradient(to right, #179BFF, #005493);
color: AliceBlue;
font-family: monospace;
text-align: center;
margin-top: 30px;
}
</style>
<button id="exit">Exit</button>
<body>
<h1>Hellope</h1>
</body>
</head>
</html>`
main :: proc() {
w := ui.new_window()
ui.bind(
w,
"exit",
proc(_: ^ui.Event) {
// Terminator alloc
// buf := make([]byte, 128)
// defer delete(buf)
// str := fmt.tprintf("%s", "Just want a string ;(")
// fmt.println(str)
fmt.println("Bye!")
ui.exit()
},
)
ui.show(w, DOC)
ui.wait()
}
Run this thing and click the exit button.
Run this thing with one of the alloc commented out and click the button again.
I'm running into this issue only with Odin.