I declare the interface in did as following:
"test": (text, text, text) -> ();
The C/C++ code as following:
int dfn_ads(void) WASM_IMPORT("ic0", "msg_arg_data_size");
void dfn_adc(void *, int, int) WASM_IMPORT("ic0", "msg_arg_data_copy");
void dfn_reply_append(void *, int) WASM_IMPORT("ic0", "msg_reply_data_append");
void dfn_reply(void) WASM_IMPORT("ic0", "msg_reply");
void dfn_print(void *, int) WASM_IMPORT("ic0", "debug_print");
void test() WASM_EXPORT("canister_update test");
void test() {
char buf[128] = "";
int sz = dfn_ads();
dfn_adc(buf, 0, sz);
dfn_print(buf+8, buf[7]);
// Encoded string: "DIDL" 0 1 0x71 LEB128(length) data
// So offset 7 holds string length (for short strings).
int n = buf[7];
//dfn_reply();
}
Call the function in CI:
dfx canister call demo_test recog '("demo_t1", "demo_t2", "demo_t3")'
Error deserializing blob 0x
Invalid data: Invalid IDL blob.
The log as following:
[Canister rrkah-fqaaa-aaaaa-aaaaq-cai] qdemo_t1
demo_t2
demo_t3
My Question is:
How to parse the 3 text input params in C/C++ language?
I haven’t found any doc to spec it.