Tcl - 如何加载静态链接的 Memchan?

发布于 2024-11-06 06:18:27 字数 664 浏览 1 评论 0原文

我正在尝试在我的应用程序中使用 Memchan 包。我能够静态编译和链接它。但不幸的是我不知道如何在我的应用程序中加载这个包。

% rs
Internal error detected during start: can't find package Memchan
can't find package Memchan
    while executing
"package require Memchan"

我跟踪到了 Memchan2.3 目录中的 pkgIndex.tcl

% cat pkgIndex.tcl
package ifneeded Memchan 2.3  [list load [file join $dir libMemchan2.3.so]]

我有两个问题:

  • 如何加载静态链接版本 libMemchan2.3.a< /代码>?
  • 当调用静态链接库时,是否有一种特殊的语法来调用package require Memchan

I am trying to use Memchan package in my application. I was able to compile and link it statically. But unfortunately I don't know how to load this package in my application.

% rs
Internal error detected during start: can't find package Memchan
can't find package Memchan
    while executing
"package require Memchan"

I traced this to the pkgIndex.tcl in Memchan2.3 directory:

% cat pkgIndex.tcl
package ifneeded Memchan 2.3  [list load [file join $dir libMemchan2.3.so]]

I have two questions:

  • How do I load the statically linked version libMemchan2.3.a ?
  • Is there a special syntax for calling package require Memchan when one calls a statically linked library?

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

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

发布评论

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

评论(1

转角预定愛 2024-11-13 06:18:27

你有一个静态链接的 memchan 包吗?好吧,这意味着您需要一个不同的包索引,其内容应该是这样的:

package ifneeded Memchan 2.3 {load {} Memchan}

load 有一个空的第一个参数,以便考虑静态链接库,但如果没有文件名,则需要第二个参数为了找到初始化函数(将是具有上述值的 Memchan_Init)。

或者,只需在脚本开头执行此操作:

load {} Memchan

这将导致内部程序包提供无论如何完成,以便任何未来的程序包都需要Memchans 将立即成功,因为该包已在使用中。


[背景信息]:如您所见,包索引文件实际上非常简单:它只是提供一些说明,说明如果您需要特定版本的特定包,这里有一个脚本可以使其可用。唯一真正的细微差别是 $dir 变量描述了加载文件时包索引文件的位置。

You've got a statically linked memchan package? Well, that means you need a different package index, whose contents should be this:

package ifneeded Memchan 2.3 {load {} Memchan}

The load has an empty first argument so that statically-linked libraries are considered, but without the filename, a second argument is needed in order to locate the initialization function (which will be Memchan_Init with the above value).

Alternatively, just do this at the start of your script:

load {} Memchan

That will cause the internal package provide to be done anyway, so that any future package require Memchans will just succeed immediately on the grounds that the package is already in use.


[Background info]: As you can see, a package index file is actually very simple: it just provides some instructions to say that if you need a particular package of a particular version, here's a script to make it available. The only real nuance is that the $dir variable describes the location of the package index file while the file is being loaded.

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