How can I write a library usable from multiple languages?

450 Views Asked by At

I am trying to write a library which can be used from multiple programming languages, for example:

  • CLR languages (C#, F#..)
  • JVM languages (Java, Kotlin, Scala..)
  • Native languages (C/C++, Rust, Objective-C, Swift..)
  • JavaScript/TypeScript

The basic way I know to achieve this is to write it in C/C++ and maintain my own bindings for each language, or to maintain separate copies of the library for each language (like Reactive extensions does). Either way, that's O(n) work for n languages.

Is there a language or tool that I can use to write the library in one language and have bindings automatically generated for other languages?

0

There are 0 best solutions below