Questions tagged [scala-native]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
42 views

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's user avatar
  • 251
0 votes
1 answer
53 views

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's user avatar
  • 251
0 votes
1 answer
78 views

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 ...
Tim Stewart's user avatar
  • 5,380
3 votes
1 answer
157 views

How to access struct members by name in scala native?

From the scala native docs at https://scala-native.readthedocs.io/en/latest/ this is how to access struct members: type Vec = CStruct3[Double, Double, Double] val vec = stackalloc[Vec] // allocate c ...
user573215's user avatar
  • 4,679
2 votes
0 answers
104 views

Is scala native garbage collector compatible with C interoperability?

I wonder when Zone or stack allocation are necessary when using C interoperability. For instance, if I call C function which takes function pointer, can I use any Scala function (with conversion to ...
abitbol's user avatar
  • 487
3 votes
1 answer
218 views

sbt scala plugin from github PR (ScalaNative) fails with value not found

If I needed to use the stable release version, I would have my project/plugins.sbt as below: addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0") I am trying ...
theFakeSheikS's user avatar
0 votes
1 answer
131 views

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 ...
Raghuveer Bhandarkar's user avatar
1 vote
1 answer
177 views

Is it possible to use libcu++ with scala-native for GPU programming?

I am trying to build a super-optimizer in scala native and to perform better I would like to have GPU support. is this possible with some GPU programming library for C or C++?
Lambda Banquo's user avatar
0 votes
1 answer
119 views

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] = ...
Lambda Banquo's user avatar
1 vote
1 answer
93 views

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: ...
GuoLiang Oon's user avatar
0 votes
1 answer
39 views

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....
Icterine Tech's user avatar
3 votes
1 answer
158 views

Can I compile a string containing Scala code to machine code using Scala Native as a library of my program?

I succeed compiling a scala project to machine code using Scala Native. But I want to generate some executable code at runtime (I plan to implement a standalone compiler from a scala-like language to ...
dawid's user avatar
  • 689
1 vote
1 answer
119 views

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's user avatar
  • 689
3 votes
1 answer
277 views

How to run Scala test in Scala native application?

I have hello world scala native app and wanted to run small scala test to this app I use the usual test command but it's throw an exception : NativeMain.scala object NativeMain { val p = new ...
NaseemMahasneh's user avatar
5 votes
1 answer
244 views

Scala Native Thread & GC issues

Currently ScalaNative is single threaded. But we can used POSIX API (for example) to create and manage threads (ans also shared resources). My questions are related to the garbage collector: is it ...
Davidd12's user avatar
2 votes
1 answer
822 views

How to determine Scala version at run-time for both Scala.js and JVM?

This question is similar to How do I get the Scala version from within Scala itself?, except I want to support Scala.js as well. I tried the util.Properties approach. Unfortunately it is not ...
Yang Bo's user avatar
  • 3,612
0 votes
1 answer
106 views

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 scala....
Francois Saab's user avatar
9 votes
2 answers
485 views

How do I build a statically linked executable with scala-native?

I would like to write a program using Scala Native but it has to run on a linux host (centos 6.5) with a very old glibc. So I would like to deploy that program as a statically linked executable, e.g. ...
gruenewa's user avatar
  • 1,686
0 votes
1 answer
557 views

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 { // ...
shem's user avatar
  • 93
13 votes
1 answer
1k views

Building an iOS application with scala-native

I'm trying to build an iOS application on os x with scala-native and running into a number of problems when doing the sbt build. Any hints about what to do are welcome. I set build.sbt, using Xcode ...
Nathaniel Novod's user avatar
1 vote
0 answers
141 views

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 (*...
remi's user avatar
  • 566
1 vote
1 answer
170 views

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 ...
Nathaniel Novod's user avatar
1 vote
1 answer
596 views

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 ...
srinivas's user avatar
5 votes
2 answers
854 views

Using scala-native for in-memory data processing

I'm wondering whether it is possible to leverage scala-native for performing large in-memory jobs. For instance, imagine you have a spark job that needs 150GB of RAM so you'd have to run 5x30GB ...
lisak's user avatar
  • 21.7k
2 votes
2 answers
564 views

Can I use JavaFX with Scala Native?

Given that there are compiled versions of the JavaFX SDK for mobile (iOS and Android), how feasible is it to generate Scala bindings from those files, and be able use them from a Scala-Native ...
Eduardo's user avatar
  • 8,382
4 votes
3 answers
2k views

Can scala-native use existing Java/Scala libraries?

I have not been able to understand if a project intended to be compiled by scala-native can: Use Java libraries? If yes, does it make scala-native an ahead of time compiler for Java as well as ...
user2759511's user avatar
0 votes
1 answer
333 views

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 ...
Richard Gomes's user avatar
0 votes
1 answer
388 views

scala native running demo

After successful building scala native trying to run the demo using following command cd scala-native sbt demoNative/run which returns following error /home/rimashm/.scalanative/rtlib-0.1-...
Rimash Mohomed's user avatar
8 votes
1 answer
2k views

Is it possible/useful to transpile Scala to golang?

Scala native has been recently released, but the garbage collector they used (for now) is extremely rudimentary and makes it not suitable for serious use. So I wonder: why not just transpile Scala to ...
sscarduzio's user avatar
  • 5,968
1 vote
2 answers
263 views

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's user avatar
6 votes
2 answers
4k views

Can I run my scala program without JVM using scala-native?

I heard about scala-native recently and it sounds very interesting ! I'm curious about what does native means here ? what does "ahead-of-time compiler" means ? I think descriptions in the web site and ...
Mahdi Zareie's user avatar
0 votes
2 answers
599 views

scala-native build failed in windwos with java.io.IOException: Cannot run program "which" error

When I build Scala native demo using sbt rtlib/publishLocal nscplugin/publishLocal it gives following error java version "1.8.0_31" Java(TM) SE Runtime Environment (build 1.8.0_31-b13) Java HotSpot(...
Rimash Mohomed's user avatar