How much interoperability exists between C ++ and Scala?

advertisements

Everybody knows about Java and Scala, but how much interoperability is there between C++ and Scala. Can classes from one be be used by the other, for example?


It's not that simple at all. Java and Scala work on the same virtual machine and scala has been designed to work well with java.

C++ generates native code, and even each compiler has its own way to generate that native code. That means that some class compiled with Visual Studio won't interact easily with another class compiled with gcc.

If you need to interact with C++, you need to use some glue with JNI http://en.wikipedia.org/wiki/Java_Native_Interface. I believe it should be straightfoward to use it with scala. You can make interaction somewhat more comfortable using Swig http://www.swig.org/