Questions tagged [scala-native]

32 questions
1
vote
1 answer

scala native: dynamically compose dynamically loaded functions

I am trying to define a helper method to dynamically compose functions which are dynamically loaded. import scala.scalanative.native._ @extern @link("dl") object dl { def dlopen(path: CString, mode: CInt): Ptr[Byte] = extern def dlsym(handle:…
GuoLiang Oon
  • 163
  • 6
1
vote
1 answer

How do I set the compilation mode of scala-native to 'release'?

The scala-native site says there is a faster executable option, but it doesn't state how to set it in SBT.
dawid
  • 663
  • 6
  • 12
1
vote
0 answers

calling scala code from C?

I am wrapping a C API in scala using scala-native, however the C API expects the user to provide callback for signalling through the API: void set_terminate (void * solver, void * state, int (*terminate)(void * state)); The callback is…
remi
  • 566
  • 3
  • 13
1
vote
1 answer

Scala native hello world fails to find _scalanative_alloc

Trying to build the Hello World example in scala native (on MacOS 10.11.6) I get the following error while linking. Where should _scalanative_alloc and _scalanative_init be defined? In my main program? If so what should it be defined as? [info]…
1
vote
1 answer

Is it possible to have zero cost abstractions on Scala Native?

I was reading the documentation of the Rust language, and I was immediately interested in Scala Native, thinking about mature libraries and insanely optimized algorithms. I've two questions here Is it possible to have zero-cost abstractions in…
srinivas
  • 11
  • 2
1
vote
2 answers

How to get started after building the source code?

I managed to build and run the demos of scala-native however I can't find any getting started guide to setup the runtime, is it just too early?
user145634
  • 125
  • 7
0
votes
1 answer

Scala Native - How to convert Int to Ptr[CInt]?

What's the right way to convert VM's Int to unmanaged CInt pointer from scala.scalanative.unsafe? val num: Int = 5 val nativeInt: Ptr[CInt] = // ?
R A
  • 149
  • 1
  • 9
0
votes
1 answer

Scala Native - Convert Array[Byte] to Ptr[Byte]

I'm trying to pass a Scala array to native code and need to do the conversion. How to convert Array[Byte] to Ptr[Byte] in Scala Native?
R A
  • 149
  • 1
  • 9
0
votes
1 answer

Can I create a static library using ScalaNative on linux?

I've written some code I'd like to share across a couple of ScalaNative command line tools I'm working on. Can I generate a library (preferably static) that I can share between multiple ScalaNative console applications? Thank you!
Tim Stewart
  • 5,350
  • 2
  • 30
  • 45
0
votes
1 answer

Using Breeze Libraries or Apache Commons with Scala Native

I am trying to use Scala native while performing few linear algebra computations (using Scala version 2.13.4 and Native version 0.4.0). When I try apache commons or Breeze library for linear algebra computations, I get the linking error as below,…
0
votes
1 answer

scala type mismatch with shorts and multiplication

I have two functions that find the factorial of a number and one works using integers, but the second using only shorts yield an error. This is the code var fac16i: Function2[Short, Short, Short] = new Function2[Short, Short, Short] { @tailrec…
Lambda Banquo
  • 81
  • 1
  • 5
0
votes
1 answer

nativeClang and nativeClang not found. I installed llvm to my path and used giter8 for the project but the program is failing. How do I fix this?

Error looks like this: [error] (nativeClang) java.io.IOException: Cannot run program "which": CreateProcess error=2, The system cannot find the file specified [error] (nativeClangPP) java.io.IOException: Cannot run program "which": CreateProcess…
0
votes
1 answer

boolean string parsing behaviour in scala-native

what could be the reason for a normal parsing code to give on the scale-native side(after compiling) the below exception: java.lang.IllegalArgumentException: For input string: "false" at…
Francois Saab
  • 77
  • 1
  • 9
0
votes
1 answer

pointer to pointer in scala-native

I'm trying to use czmq with scala-native and I haven't found a way to create pointer in scala-native. here is extern: @native.link("czmq") @native.extern object czmq { //struct _zsock_t { // uint32_t tag; // Object tag for runtime…
shem
  • 83
  • 5
0
votes
1 answer

Can I generate Scala bindings for Objective-C and C++ with scala-bindgen?

I've recently found scala-bindgen from a Gitter room on Scala Native. Seems like (at the present point in time) they are developing a tool for generating Scala bindings for C header files. Are there plans for generating Scala bindings for…
Richard Gomes
  • 5,675
  • 2
  • 44
  • 50