eos icon indicating copy to clipboard operation
eos copied to clipboard

can contract action return object

Open GeneSourceCode opened this issue 8 years ago • 1 comments

I find that when I define an action within contract with a object return type, I get a compiling error message of

error: no matching function for call to 'execute_action'
EOSIO_ABI(
^~~~~~~~~~
/usr/local/include/eosiolib/dispatcher.hpp:85:13: note: expanded from macro 'EOSIO_ABI'
            EOSIO_API( TYPE, MEMBERS ) \
            ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/eosiolib/dispatcher.hpp:72:27: note: expanded from macro 'EOSIO_API'
   BOOST_PP_SEQ_FOR_EACH( EOSIO_API_CALL, TYPE, MEMBERS )
   ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/opt/boost/include/boost/preprocessor/seq/for_each.hpp:29:88: note: expanded from macro 'BOOST_PP_SEQ_FOR_EACH'
#    define BOOST_PP_SEQ_FOR_EACH(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK(macro, data, seq)
                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
note: (skipping 21 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/root/opt/boost/include/boost/preprocessor/seq/for_each.hpp:78:76: note: expanded from macro 'BOOST_PP_SEQ_FOR_EACH_M_IM'
#    define BOOST_PP_SEQ_FOR_EACH_M_IM(r, im) BOOST_PP_SEQ_FOR_EACH_M_I(r, im)
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~                                                                                        /root/opt/boost/include/boost/preprocessor/seq/for_each.hpp:83:61: note: expanded from macro 'BOOST_PP_SEQ_FOR_EACH_M_I'
# define BOOST_PP_SEQ_FOR_EACH_M_I(r, macro, data, seq, sz) macro(r, data, BOOST_PP_SEQ_HEAD(seq))                                                                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                    /usr/local/include/eosiolib/dispatcher.hpp:68:7: note: expanded from macro 'EOSIO_API_CALL'                                                                                 eosio::execute_action( &thiscontract, &OP::elem ); \
      ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/eosiolib/dispatcher.hpp:41:9: note: candidate template ignored: could not match 'void' against 'GeneMelee::Elf'
   bool execute_action( T* obj, void (Q::*func)(Args...)  ) {

can I define an action with non void type?

GeneSourceCode avatar Jun 09 '18 03:06 GeneSourceCode

No. You can store data in tables and use JSON RPC to query them.

tbfleming avatar Jun 09 '18 13:06 tbfleming