diff options
author | Jakob Odersky <jodersky@gmail.com> | 2015-12-06 17:03:08 -0800 |
---|---|---|
committer | Jakob Odersky <jodersky@gmail.com> | 2015-12-06 17:09:40 -0800 |
commit | e2505d1d9e2e49554057a8cd5fb71b0ac0e3ba63 (patch) | |
tree | f4fec79ba707aa9b2dec903d54a164f357961f19 /samples/basic/basic-main/src/main | |
parent | 3e90312b3f2d912bf27e91b454a6ef21a81a2fc5 (diff) | |
download | sbt-jni-e2505d1d9e2e49554057a8cd5fb71b0ac0e3ba63.tar.gz sbt-jni-e2505d1d9e2e49554057a8cd5fb71b0ac0e3ba63.tar.bz2 sbt-jni-e2505d1d9e2e49554057a8cd5fb71b0ac0e3ba63.zip |
Use separate project for native libraries
Diffstat (limited to 'samples/basic/basic-main/src/main')
-rw-r--r-- | samples/basic/basic-main/src/main/scala/ch/jodersky/jni/basic/Library.scala | 8 | ||||
-rw-r--r-- | samples/basic/basic-main/src/main/scala/ch/jodersky/jni/basic/Main.scala | 13 |
2 files changed, 21 insertions, 0 deletions
diff --git a/samples/basic/basic-main/src/main/scala/ch/jodersky/jni/basic/Library.scala b/samples/basic/basic-main/src/main/scala/ch/jodersky/jni/basic/Library.scala new file mode 100644 index 0000000..efe3018 --- /dev/null +++ b/samples/basic/basic-main/src/main/scala/ch/jodersky/jni/basic/Library.scala @@ -0,0 +1,8 @@ +package ch.jodersky.jni.basic + +/** A demo object, mapping to a native library. */ +object Library { + + @native def print(message: String): Int + +} diff --git a/samples/basic/basic-main/src/main/scala/ch/jodersky/jni/basic/Main.scala b/samples/basic/basic-main/src/main/scala/ch/jodersky/jni/basic/Main.scala new file mode 100644 index 0000000..b46f0d1 --- /dev/null +++ b/samples/basic/basic-main/src/main/scala/ch/jodersky/jni/basic/Main.scala @@ -0,0 +1,13 @@ +package ch.jodersky.jni.basic + +import ch.jodersky.jni.NativeLoader + +object Main { + + def main(args: Array[String]): Unit = { + NativeLoader.load("/ch/jodersky/jni/basic", "demo1") + val r = Library.print("Hello world!\n") + println("Returned: " + r) + } + +} |