I was following Erlang C Nodes tutorial and was trying to make a wrapper call for libXl C library. In my C node a create a BookHandle and pass it as a response for one message call.
BookHandle book = xlCreateBook();
resp = erl_format("{ok, ~w}", erl_mk_binary(book, sizeof book));
erl_send(fd, fromp, resp);
My question is can I use that reponse to send another message to C node with that same object? For example to send
{any, 'c1@CST1'} ! {self(), {step2,Result}},
and in C node to have something like the code below to get the passed BookHandle
if (strncmp(ERL_ATOM_PTR(fnp), "step2", 3) == 0) {
BookHandle book = (BookHandle)ERL_BIN_PTR(argp);
xlBookLoad(book, "example.xls");
}
Is something like this even possible, or would creating a wrapper for specific function require to create BookHandle every time I send a message to C Node.
Sorry if this doesn't make any sense, I'm new to this all.