Created
May 12, 2011 15:11
-
-
Save dln/968700 to your computer and use it in GitHub Desktop.
Using JNA directly from the Scala REPL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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