Struct operations in Javascript through Emscripten
I am having quite a lot of problems with emscripten inter-operating between C and Javascript. More specifically, I am having trouble accessing a struct created in C in javascript, given that the pointer to the struct is passed into javascript as an external library . Take a look at the following code: C: #include <stdlib.h> #include <stdio.h> #include <inttypes.h> struct test_st; extern void read_struct(struct test_st *mys, int siz); struct test_st{ uint32_t my_number; uint8_t my_char_array[32]; }; int main(){ struct test_st *teststr = malloc(sizeof(struct test_st)); teststr->my_number = 500;