F# 电源包和分发

发布于 2024-09-03 08:33:05 字数 414 浏览 1 评论 0原文

我需要任意精度的有理数,据我了解,F# powerpack 中提供了这些数。我的问题是关于分配机制的;我的程序至少需要能够在 Windows/.Net 和 Linux/Mono 上编译和运行,因为我在这两个平台上都有潜在用户。据我了解,最好的过程是:

  1. 下载 powerpack .zip,而不是安装程序。

  2. 将 DLL 复制到我的程序目录中。

  3. 将随附的许可证文件复制到我的程序目录中,以确保一切都光明正大。

  4. 声明引用并继续使用我需要的函数。

  5. 将上述文件与我的源代码和二进制文件一起发送,并且由于 DLL 使用字节代码,因此它可以在任何平台上正常工作。

    将上述文件与我

这是正确的程序吗?我错过了什么吗?

I need arbitrary precision rational numbers, which I'm given to understand are available in the F# powerpack. My question is about the mechanics of distribution; my program needs to be able to compile and run both on Windows/.Net and Linux/Mono at least, since I have potential users on both platforms. As I understand it, the best procedure is:

  1. Download the powerpack .zip, not the installer.

  2. Copy the DLL into my program directory.

  3. Copy the accompanying license file into my program directory, to make sure everything is above board.

  4. Declare references and go ahead and use the functions I need.

  5. Ship the above files along with my source and binary, and since the DLL uses byte code, it will work fine on any platform.

Is this the correct procedure? Am I missing anything?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独夜无伴 2024-09-10 08:33:05

您基本上是正确的,任意精度有理数仅在 PowerPack 中可用(BigInteger 是 .NET 4.0 的一部分,但有理数仍然是 F# 特定的)。

但是,您还需要使用 F# 运行时可再发行组件(即 FSharp.Core.dll 程序集)来分发您的程序。它包含一些不属于标准 .NET 运行时一部分的基本 F# 类型(例如用于表示函数的类型)。

当您添加对项目的引用时,编译器会在应用程序中包含引用库的名称和版本。当应用程序启动时,运行时会尝试在各个位置找到该库。因此,要在 .NET 和 Mono 上部署应用程序,您需要(以某种方式)将应用程序与 FSharp.Core.dll 和 FSharp.PowerPack.dll 一起分发>。

  • F# Redistributable 和 F# PowerPack 安装程序将库放置到 GAC(全局程序集缓存)中,该库由计算机上的所有 .NET 应用程序共享。在 Mono 上,您可以使用 gacutil 工具(从命令行)获得相同的结果。在这种情况下,您需要将它们复制到某个地方(任何地方)并运行此工具。您的应用程序将在 GAC 中找到它们。

  • 或者,如果将程序集放置到与应用程序(exe 文件)相同的文件夹中,那么 .NET 和 Mono 也应该正确找到它们并且它应该可以工作。我认为出于版本控制的原因,不鼓励这样做(例如,可以轻松更新全局安装的文件),但我不认为许可证禁止这种形式的部署。

看起来,为了创建 .NET/Mono 可再发行组件,使用第二种技术会更容易(因为它允许简单的 xcopy 部署)。

You're essentially correct, arbitrary precision rational numbers are available only in PowerPack (BigInteger is part of .NET 4.0, but rationals are still F# specific).

However, you'll also need to distribute your program with F# runtime redistributable (that is the FSharp.Core.dll assembly). It contains some basic F# types (such as types used to represent functions) that are not a part of standard .NET runtime.

When you add a reference to your project, the compiler includes the name and version of the referenced library in your application. When the application starts, the runtime tries to locate the library in various places. So, to deploy your application on both .NET and Mono, you'll need to (somehow) distribute your application together with FSharp.Core.dll and FSharp.PowerPack.dll.

  • The F# Redistributable and F# PowerPack installers place the library to GAC (Global Assembly Cache) which is shared by all .NET apps on the computer. On Mono, you can get the same result by using the gacutil tool (from command line). In that case, you need to copy them somewhere (anywhere) and run this tool. Your application will find them in the GAC.

  • Alternatively, if you place the assemblies to the same folder as your application (exe file) then both .NET and Mono should locate them correctly as well and it should work. I believe that this is discouraged for versioning reasons (e.g. the globally installed file can be easily updated), but I don't think the license prohibits this form of deployment.

It seems that for creating .NET/Mono redistributable, using the second technique would be easier (as it allows simple xcopy depoloyment).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文