例如,转换Jama-Library(以Java编写)可以正常工作,转换Scama(以Scala编写)不起作用。
有没有办法将scala代码转换成dll?有没有Scala to Java转换工具?
最好的问候, Christoph
解决方案我不了解.NET,但从SK-logic和您的意见来判断问题: sbt package does 不包括Scala运行时库,因为它假定您要将项目导出为要在其他Scala项目中使用的库。
因此,您将需要创建一个包含运行时的胖jar。例如,在此博客您可以通过转换项目jar和运行时jar来了解作者如何创建完全独立的可执行文件。
有不同的工具可以做到这一点SBT。最简单的是 sbt-assembly ,但是最终会出现一个非常大的文件,因为它只是添加了整个运行时。如果这是一个问题,您可能需要使用 proguard插件。有关此主题的更多信息,请参阅另一个StackOverflow条目。
I'm trying to create a Dll out of a scala-class. I'm using IntelliJ together with SBT. I've already found a way to convert .jar files into a Dll, using the ikvm-converter. Now the problem: When I use "package" under SBT to create a .jar file out of my .scala file and try to convert it afterwards with ikvmc into a Dll the resulting library is empty when integrated in C#...
For example converting the Jama-Library (which is written in Java) works fine, where converting Scama (written in Scala) does not work.
Is there a way to do this conversion of scala code into a dll? Is there a "Scala to Java"-conversion tool?
Best Regards, Christoph
解决方案I have no knowledge of .NET, but judging from SK-logic's and your comments to the questions: sbt package does not include the Scala runtime library, because it assumes you are going to export your project as a library to be used within other Scala projects.
Therefore, you will need to create a "fat" jar that contains the runtime. For example, in this blog you can see how the author creates a fully self-contained executable, by converting both the project jar and the runtime jar.
There are different tools to do that with sbt. The easiest would be sbt-assembly, but you will end up with a very large file, because it just adds the whole runtime. If that is a problem, you may want to filter the runtime instead, using the proguard plugin. More on this topic in another StackOverflow entry.
更多推荐
将Scala库转换为DLL(.NET)
发布评论