Search code examples
scala-native

Can scala-native use existing Java/Scala libraries?


I have not been able to understand if a project intended to be compiled by scala-native can:

  1. Use Java libraries? If yes, does it make scala-native an ahead of time compiler for Java as well as Scala?
  2. Use Scala libraries (compiled to JVM bytecode)

I understand only part of the Scala standard library is available. Is it because there are parts of the implementation using Java standard library?
In case it can't, wouldn't this drawback make it almost impossible for a [non-trivial] project to compile to both the JVM and native using a single code base? Are there plans in this direction?


Solution

  • I'm far from an expert here but I asked a similar question on Reddit and received the answer that scala-native does not interact with Java libraries (so I took it that it could not compile them either).

    It can connect to native ('c') libraries instead.

    I don't know of any plans for this to change.