2

I would like to develop my contracts in a way where I can pass a compile time flag to enable/disable debugging code so that the debugging functionality would not be compiled into the "production" version of the contract. eg.

#if DEBUG
  void cleartables() {
    // clear all table code here
  }
#endif
2

Define your variables in the environment variable EOSIOCPP_CFLAGS. If you are curious, just open the eosiocpp file (it's a bash script, a wrapper over clang) to see how the variable is used.

| improve this answer | |
  • Thanks. It's taken me a while to get around to it but that helped a lot. Ive been able to pass macros into eosio-cpp with the newer tools and get exactly what I need done. – Dallas Johnson Sep 16 '18 at 11:11
0

you can also pass the values when you compile the contract e.g. eosio-cpp -D=DEBUG ...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.