Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

GnaneshKunal/scala-native-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scala-Native Starter . Build Status

Background

Requirements

  • scala 2.11.x
  • sbt 0.13.16

Installation

In your app directory run sbt to install all the dependencies

sbt    

Usage

Link libraries

Add your compilation script in makefile file:

clang -m64 -c src/main/c/hello.c -o target/libhello.so

And in your scala file

    import scalanative.native._
    
    @extern
    @link("hello")
    object hello {
      def greet(str: CString, n: CInt): CString = extern
    }

Compile

    sbt compile

Compile, link and run

    sbt run

Run

After compiling, you can find the executable file in target/{SCALA_VERSION}/EXE

    target/scala-2.11/scala-native-starter-out

License

The MIT License (MIT)