summaryrefslogtreecommitdiff
path: root/test/pending/jvm/natives.scala
blob: 14ee4e1c1b03e0f05b6f1a67aecad75f2c98f270 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
object Test {

  //println("java.library.path=" + System.getProperty("java.library.path"))

  val sysWordSize = System.getProperty("sun.arch.data.model", "32")
  val sysType = System.getProperty("os.name")

  val libName =
    if (sysType == "Mac OS X")
      "natives"
    else
      "natives-" + sysWordSize

  System.loadLibrary(libName)

  @native
  def sayHello(s: String): String = null

  def main(args: Array[String]) {
    val s = sayHello("Scala is great!")
    println("Invocation returned \"" + s + "\"")
  }
}