As you can see they differ only in attributes and use of the extern keyword.
I would like to have only one crate for both C++ and WASM and just compile it with different compiler options to get the C library or the WASM file.
I'm not sure how to do this in a better way. I do not see a way to do this with just conditional compilation. As for macros, I do not have any experience with that or even any knowledge beyond brief reading of the docs, but I can imagine doing something like:
But adding function args will make it even uglier. Maybe there are better alternatives.