summaryrefslogtreecommitdiff
path: root/test/files/jvm/natives.scala
blob: ba868dc85ed47f3a012a1757e8ab2d26b7f4000b (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 + "\"")
  }
}