Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 04 17:03
    LeeTibbert labeled #3019
  • Dec 04 17:02
    LeeTibbert labeled #3021
  • Dec 04 17:01
    LeeTibbert labeled #3022
  • Dec 04 17:01
    LeeTibbert unlabeled #3024
  • Dec 04 17:00
    LeeTibbert labeled #3024
  • Dec 04 17:00
    LeeTibbert labeled #3015
  • Dec 04 16:59
    LeeTibbert labeled #3025
  • Dec 04 16:58
    LeeTibbert unlabeled #2986
  • Dec 04 16:57
    LeeTibbert labeled #2986
  • Dec 04 16:57
    LeeTibbert labeled #2986
  • Dec 04 16:56
    LeeTibbert assigned #2900
  • Dec 04 16:56
    LeeTibbert labeled #2900
  • Dec 04 16:54
    LeeTibbert commented #2899
  • Dec 04 16:46
    LeeTibbert labeled #3025
  • Dec 04 15:05
    LeeTibbert edited #3025
  • Dec 04 15:04
    LeeTibbert synchronize #3025
  • Dec 04 14:57
    LeeTibbert opened #3025
  • Dec 04 12:25
    armanbilge commented #2800
  • Dec 04 12:08
    TheElectronWill commented #2800
  • Dec 04 12:06
    TheElectronWill commented #2800
Eric K Richardson
@ekrich
Yes, it work unchanged on 64 bit ARM. I have not cross compiled on AMD for ARM. We added the ability to provide the target triple but don't know how the rest of that process works - install the ARM includes and libs? If you can achieve this is would be great to add a How-to in the docs. All we have so far - https://scala-native.readthedocs.io/en/latest/user/sbt.html#cross-compilation-using-target-triple
Hanns Holger Rutz
@Sciss
ok, i'll try
Eric K Richardson
@ekrich
:thumbsup: Good luck.
Ghost
@ghost~61b216ac6da03739848c2eaf

Hi folks, I've probably tried something wrong: I wanted to apply Scala Native on a small Vert.x application. I get the error message (on MacOS):

[error] (Compile / nativeLink) java.lang.ClassCastException: class scala.scalanative.linker.Unavailable cannot be cast to class scala.scalanative.linker.ScopeInfo (scala.scalanative.linker.Unavailable and scala.scalanative.linker.ScopeInfo are in unnamed module of loader sbt.internal.PluginManagement$PluginClassLoader @41da3aee)

Is this something that should work? My impression so far is that Scala Native is for more basic applications.

Eric K Richardson
@ekrich
Hi @oliver-brm I am not sure exactly what you are trying to do - call Java code?
There is also a newer chat for Scala Native here - https://discord.gg/scala
We can continue here but most of the group follows over there for Scala.
Ghost
@ghost~61b216ac6da03739848c2eaf
Hi @ekrich, I was naively trying to use Scala Native just like GraalVM. But the more I understand what Scala Native is, the more I think I was on the wrong track, right? :-)
Eric K Richardson
@ekrich
@oliver-brm If you want to do Scala and have have native then either Scala/JVM with graal or Scala Native is the choice. What do you want to do exactly? Do you want to stay here or move to the Discord? I am glad to help you get started or answer questions.
Denys Shabalin
@densh
Hi all this is a gentle reminder that this chat room is deprecated and we should continue chatting on discord channel instead.
Tobias Roeser
@lefou
Please update the description of the chat room to indicate, this room is no longer active.
Denys Shabalin
@densh
Done.
Tobias Roeser
@lefou
:+1:
nrktkt
@nrktkt:matrix.org
[m]
For matrix users, we now have #scala-native:matrix.org which is (or will shortly be) bridged into the Scala Native Discord channel
nrktkt
@nrktkt:matrix.org
[m]
!discord bridge 632150470000902164 635668881951686686
Discord Bridge
@_discord_bot:t2bot.io
[m]
ERROR: insufficient permissions to use this command! Try !discord help to see all available commands
Ashkan Kh. Nazary
@ashkann

Hello everyone. How do I get access to a #define XXX in Scala ? the @extern , @name and other goodies work as long as it is a function but doesn't find the #defines :

@link("glfw")
@extern
object glfw {
  @name("GLFW_CLIENT_API")
  def CLIENT_API: CInt = extern

  @name("GLFW_NO_API")
  def NO_API: CInt = extern

  @name("glfwWindowHint")
  def windowHint(a: Unit, b: Unit): Unit = extern
}

finds the glfwWindowHint but not GLFW_CLIENT_API and GLFW_NO_API

[error] Undefined symbols for architecture x86_64:
[error]   "_GLFW_CLIENT_API", referenced from:
[error]       __SM5Main$D4mainLAL16java.lang.String_uEO in 2.ll.o
[error]   "_GLFW_NO_API", referenced from:
[error]       __SM5Main$D4mainLAL16java.lang.String_uEO in 2.ll.o
[error] ld: symbol(s) not found for architecture x86_64
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
Currently I don't think you can access defs directly.
You can write a forwarder function in C (that returns the constant), put it in src/main/resources/scala-native/ and then extern that in SN instead
Ashkan Kh. Nazary
@ashkann

looking into the src to see what scala-native does for its supported libs, I found this:

#include <math.h>

float scalanative_huge_valf() { return HUGE_VALF; }

double scalanative_huge_val() { return HUGE_VAL; }

float scalanative_infinity() { return INFINITY; }

float scalanative_nan() { return NAN; }

int scalanative_math_errhandling() { return math_errhandling; }

int scalanative_math_errno() { return MATH_ERRNO; }

int scalanative_math_errexcept() { return MATH_ERREXCEPT; }

Does this mean I'm basically out of luck :D ?

@velvetbaldmime:matrix.org yeah, apparently no way around it.
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
Yeah, given that defs are inlined and not present in the linked code, SN has nothing to reference really
Ashkan Kh. Nazary
@ashkann
I can look at the value from C and define a val myself. I'm thinking pros/cons ...
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
I would use a forwarder function because of waves hands various #ifdefs for platforms/flags/compiler versions etc.
With a forwarder you don't have to worry that the value will go out of date if you link with different flags/on different platform
I'm writing a binding generator and the little knowledge I acquired suggests to me that I should not make any assumptions about the values of the constants in large libraries :D
1 reply
Ashkan Kh. Nazary
@ashkann
Yeah you are right. I just wasn't thinking straight for a moment. The dread of doing this for every #def I'm gonna use
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
Yeah it's pretty horrible, unfortunately. There are a few other gotchas with globals, which actually came up recently when David was trying to write a binding for sqlite, I think: indoorvivants/sn-bindgen#4

I had no idea that

/* Link global variable declared in global.c to this program */
extern int num1, num2;

was even a thing, so things like this probably need both setters and getters

Eric K Richardson
@ekrich
C has a flat namespace so lots of things are a bit weird.
Ashkan Kh. Nazary
@ashkann
global state is a dread on its own, with or without scala-native
Eric K Richardson
@ekrich
:100:
Stefanos Mandalas
@sealmove
Hi. I am playing around with c interop and I got stuck at the very beginning. The following code fails at compile time:
object Main {
  def main(args: Array[String]): Unit = {
    stdio.printf(c"a string: %s\n", c"the string")
  }
}
With diverging implicit expansion for type scala.scalanative.unsafe.Tag[T1]
Eric K Richardson
@ekrich
@sealmove Not many people here anymore as we moved to Discord. Hope you can join - https://discord.com/invite/scala
BracketMaster
@BracketMaster
Is there a way to run scala native without SBT?
João Costa
@jd557:matrix.org
[m]
There's mill and scala-cli
Srepfler Srdan
@schrepfler
can scala-native be used for something like Unreal engine?
Srepfler Srdan
@schrepfler
And did someone posted an article about using snunit and scala native recently, I seem to have lost that article.
Lorenzo Gabriele
@lolgab
This is the blog post :)
About the first one, if they offer a C api, why not? :)
Lorenzo Gabriele
@lolgab
Actually you might need to ability to create dynamic libraries which is not supported at the moment.
Leon Burdinov
@leonbur
Hi! I have created a CLI tool that I compiled using scala native. Since I'm pretty new to SN, how would I go about compiling to multiple architectures at once (mac M1, mac Intel, ubuntu Intel,...) with different file names? I'm using the sbt plugin. my repo: https://github.com/leonbur/table
1 reply
renghen
@renghen
hi to all, does scala native have support for c++ ffi?
Lorenzo Gabriele
@lolgab
No, it doesn't have. You need to create an extern "C" block in C++ and export what you need as C functions.
You can do it inside your Scala Native module in a .cpp file inside your resources ( in src/main/resources/scala-native) and they will be compiled and linked in your Scala Native application.
kerr
@hepin1989
scala-native/scala-native#2351
Will this get into 0.5, thanks
Ayub
@Ajob41
Hi community
I am glad I joined this amazing community.
You know I was wondering if Scala native is considered systems programming language similar to C, C++ or Rust.
João Costa
@jd557:matrix.org
[m]

Hey @Ajob41:
Most of the community is at #scala-native:matrix.org (or discord).

Regarding your question, I would say so. There was even a book mentioning that in the title: https://www.amazon.com/Modern-Systems-Programming-Scala-Native/dp/1680506226

The book is pretty outdated by now, though