Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/GnaneshKunal/scala-native-starter
A starter for scala-native.
https://github.com/GnaneshKunal/scala-native-starter
c native scala scala-native
Last synced: about 2 months ago
JSON representation
A starter for scala-native.
- Host: GitHub
- URL: https://github.com/GnaneshKunal/scala-native-starter
- Owner: GnaneshKunal
- License: mit
- Archived: true
- Created: 2017-10-02T10:12:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-24T15:12:56.000Z (almost 7 years ago)
- Last Synced: 2024-04-22T13:32:44.309Z (9 months ago)
- Topics: c, native, scala, scala-native
- Language: Scala
- Homepage: http://www.scala-native.org/
- Size: 8.79 KB
- Stars: 27
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-scala-native - Starter for Scala Native - Scala Native project that links to a custom C library. (Tutorials and Examples)
README
# Scala-Native Starter . [![Build Status](https://travis-ci.org/GnaneshKunal/scala-native-starter.svg?branch=master)](https://travis-ci.org/GnaneshKunal/scala-native-starter.svg?branch=master)
## Background* [Dependencies](https://github.com/GnaneshKunal/scala-native-starter/blob/master/bin/travis_setup.sh#L29-L39)
* [Additional Dependencies](https://github.com/crystal-lang/crystal/wiki/All-required-libraries)## 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
```scala
import scalanative.native._
@extern
@link("hello")
object hello {
def greet(str: CString, n: CInt): CString = extern
}
```### Compile
```bash
sbt compile
```### Compile, link and run
```bash
sbt run
```## Run
After compiling, you can find the executable file in target/{SCALA_VERSION}/EXE
```bash
target/scala-2.11/scala-native-starter-out
```## License
The MIT License (MIT)