-
Notifications
You must be signed in to change notification settings - Fork 290
Support std::array by adding ABI symbol T[N] #1196
Conversation
…ctor<int>, int[4] means array<int,4>)
…rray<std::string,4>, 2> test, also add using_std_array.cpp/json under tool_chain
|
||
struct my_struct { | ||
uint32_t id; | ||
std::array<std::array<std::string,4>,2> aastr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better use typedef here for above array of arrays like typedef std::arraystd::string,4 ary_str4 and then use array<ary_str4,2> as the type of above aastr.
Because so far any abi-type ending with [][] would result in failure when tring to use cleos to put data into nodeos, e.g if using vector<vector<uint16_t> > vv, then using cleos to set vv as shown at https://github.com/EOSIO/nested-container/blob/main/nestcontn2a/nestcontn2a.cpp#L392 would result in Error 3015004: The type defined in the ABI is invalid, Error Details: uint16[][], the problem currently can be resolved by typedef vector<uint16_t> vec_uint16, and then use vector<vec_uint16> vv, the corrsponding type of vv would be vec_uint16[], instead of uint16[][]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed, use typedef std::arraystd::string,4 array_string_4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also suggest: 1. move the toolchain test using_std_array
to abigen-pass
and add json option abi-file
pointing to the expected ABI file containing "type": "int32[32]"
(see current nested_container
under abigen-pass
as an example); 2. shorten the PR title and move details into the PR description. Excellent work!
moved to abigen-pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After other related PRs in abieos are done, let's revisit the complete solution for std::array support.
Support std::array by adding abi symbol T[N]
Change Description
EPE 948
The build crash was caused by std::array was not supported. After this change, cdt build is OK.
The running of wasm action is partly support , std::array can be used inside action, in structure, or nested using in structure.
However using std::array as a parameter of action is not supported so far.
API Changes
Documentation Additions