You can use C++/C to do this but depending on what you're doing it probably won't save you much time. You could also use JS to share code since both platforms have JS interpreters you can run arbitrary code in - but the ergonomics of this would likely be sup-optimal. For most apps, the vast majority of the work in mobile is the front-end - so sharing code this way would just end up being a headache.