I'm having compilation issues when creating a custom dispatcher. I'm getting issues when calling EOSIO_DISPATCH. Is it related to changes in new CDT?
class [[eosio::contract("mycontract")]] mycontract : public contract {
...
};
extern "C" {
void apply(uint64_t receiver, uint64_t code, uint64_t action) {
myContract thiscontract(name(receiver));
if (((code == name("eosio.token").value) &&
(action == name("transfer").value)) {
execute_action(name(receiver), name(code) &myContract::transfer);
return;
}
if (code != receiver) return;
switch (action) { EOSIO_DISPATCH(myContract, (transfer)(receipt))
}
eosio_exit(0);
}
}
Errors and warnings I am getting:
warning: parentheses were disambiguated as a function
declaration [-Wvexing-parse]
mycontract thiscontract(name(receiver));
^~~~~~~~~~~~~~~~
note: add a pair of parentheses to declare a variable
mycontract thiscontract(name(receiver));
^
( )
warning: 'thiscontract' has C-linkage specified, but
returns user-defined type 'mycontract' which is incompatible with C
[-Wreturn-type-c-linkage]
mycontract thiscontract(name(receiver));
^
error: call to non-static member function without an
object argument
execute_action(name(receiver), name(code) &mycontract::transfer);
~~~~~~~~~~~~~~^~~~~~~~
error: expected unqualified-id
switch (action) { EOSIO_DISPATCH(mycontract, (transfer)(receipt)...
^
/usr/local/Cellar/eosio.cdt/1.5.0/opt/eosio.cdt/bin/../include/eosiolib/dispatcher.hpp:117:8: note: expanded from macro 'EOSIO_DISPATCH' extern "C" { \