try/catch doesn't work with C interop and structs
geekrelief opened this issue · 0 comments
geekrelief commented
I've been working with a C library, and the try/catch mechanism doesn't work well for digging into structs.
For example, I call function that returns a ptr
.
let draw: ptr tm_creation_graph_draw_call_data_t = render_component_api.draw_call(...)
if ?draw.shader:
# do stuff
If draw
is nil then I'll get a crash because the access violation is coming from C and not from Nim. My work around is to use my conditional access macro that does checks at each step.
if ?draw.?shader:
# do stuff