0

I've written some code I'd like to share across a couple of ScalaNative command line tools I'm working on.

Can I generate a library (preferably static) that I can share between multiple ScalaNative console applications?

Thank you!

Tim Stewart
  • 5,350
  • 2
  • 30
  • 45

1 Answers1

0

Starting from Scala Native 0.4.8 it can generate dynamic and static libraries.

What you need to do is add the following to your build.sbt file.

To generate a dynamic library:

import scala.scalanative.build.BuildTarget

nativeConfig ~= {
  _.withBuildTarget(BuildTarget.libraryDynamic)
}

To generate a static library:

import scala.scalanative.build.BuildTarget

nativeConfig ~= {
  _.withBuildTarget(BuildTarget.libraryStatic)
}
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 07 '23 at 06:48