Skip to content

Instantly share code, notes, and snippets.

@dln
Created May 12, 2011 15:11
Show Gist options
  • Save dln/968700 to your computer and use it in GitHub Desktop.
Save dln/968700 to your computer and use it in GitHub Desktop.
Using JNA directly from the Scala REPL
$ scala
Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :cp /usr/share/java/jna.jar
Added '/usr/share/java/jna.jar'. Your new classpath is:
.:/usr/share/java/jna.jar
scala> import com.sun.jna._
import com.sun.jna._
scala> object HelloWorld { Native.register("m"); @native def sin(d: Double): Double }
defined module HelloWorld
scala> HelloWorld.sin(42)
res0: Double = -0.9165215479156338
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment