34 questions
1
vote
1
answer
62
views
Is Scala Native big-endian or little-endian?
Java uses network byte order for storing numerical values in memory. But what about Scala Native? Does it follow JVM's approach or brings something new?
1
vote
1
answer
71
views
How to fix test.nativeLink scala.scalanative.build.BuildException error
I'm trying to run a test on a scala native code that calls a C function from within it but got this error. Modified to provide more error output
[build.mill-57/61] compile
[build.mill-57] [info] ...
0
votes
1
answer
106
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] = // ?
0
votes
2
answers
167
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?
0
votes
1
answer
171
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 ...
3
votes
1
answer
237
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 ...
2
votes
0
answers
147
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 ...
3
votes
1
answer
294
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 ...
0
votes
1
answer
176
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 ...
1
vote
1
answer
291
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++?
0
votes
1
answer
143
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] = ...
1
vote
1
answer
106
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: ...
0
votes
1
answer
68
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....
3
votes
1
answer
186
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 ...
1
vote
1
answer
159
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.