obj_p x = error(5, "myerror");
obj_p fmt = obj_fmt(x, B8_TRUE);
printf("%.*s", (uint32_t)fmt->len, as_string(fmt));
drop_obj(fmt);
int size = size_obj(x);
u8_t buf[4096];
int size1 = save_obj(buf, size, x);
printf("size = %d\n", size);
printf("size1 = %d\n", size1);
•• [E005] error: type mismatch myerror
size = 10
size1 = 15
The following code:
produces this output:
Also,
load_obj()moves the pointer not according to the size in the header.