如何制作 Intersystems Caché 使用新编译的类而不是旧的类?

发布于 2024-07-12 06:05:35 字数 987 浏览 10 评论 0原文

我在加载和编译现有类的新版本时遇到问题。 在加载它们时,没有任何对它们的引用。 “Test.Extended”类扩展了“Test.Base”类。 类“Extended”调用类“Base”上的ClassMethod。 问题是,即使在两个类上加载并执行强制编译之后,被调用的“Base”中的 ClassMethod 也不是新编译类上的方法,而是它的旧版本(已确认)通过写入控制台)。

要编译这两个文件,我在终端使用以下命令(f:表示强制,c:表示加载时编译):

NAMESPACE>w $system.OBJ.Load("C:\Test.Base.cls.xml","fc")

Load started on 01/27/2009 10:10:34
Loading file C:\Test.Base.cls.xml as xml
Imported class: Test.Base
Compiling class Test.Base ..................
Compiling routine Test.Base.1
Load finished successfully.
1

NAMESPACE>w $system.OBJ.Load("C:\Test.Extended.cls.xml","fc")

Load started on 01/27/2009 10:10:34
Loading file C:\Test.Extended.cls.xml as xml
Imported class: Test.Extended
Compiling class Test.Extended ..................
Compiling routine Test.Extended.1
Compiling routine Test.Extended.2
Load finished successfully.
1

我们需要系统自动加载和编译这两个文件,但我们不能这样做,因为系统一直使用旧版本。 有人知道如何强制 Intersystems Caché 使用最新版本的编译类吗?

谢谢, 路易斯

I'm having trouble with loading and compiling a new version of existing classes. At the time they are loaded, there aren't any references in use to them. Class "Test.Extended" extends class "Test.Base". Class "Extended" calls a ClassMethod on class "Base". The problem is that even after loading and performing a forced compile on both classes, the ClassMethod from "Base" that gets called is not the method on the new compiled class, but the older version of it (confirmed by writing to the console).

To compile both, I'm using the following commands from the terminal (f: means force, c: means compile while loading):

NAMESPACE>w $system.OBJ.Load("C:\Test.Base.cls.xml","fc")

Load started on 01/27/2009 10:10:34
Loading file C:\Test.Base.cls.xml as xml
Imported class: Test.Base
Compiling class Test.Base ..................
Compiling routine Test.Base.1
Load finished successfully.
1

NAMESPACE>w $system.OBJ.Load("C:\Test.Extended.cls.xml","fc")

Load started on 01/27/2009 10:10:34
Loading file C:\Test.Extended.cls.xml as xml
Imported class: Test.Extended
Compiling class Test.Extended ..................
Compiling routine Test.Extended.1
Compiling routine Test.Extended.2
Load finished successfully.
1

We need those two file to be loaded and compiled automatically by the system, but we can't do that, because the system keeps using the older version. Does anybody have an idea on how to force Intersystems Caché to use the latest version of compiled classes?

Thanks,
Luis

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

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

发布评论

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

评论(1

再浓的妆也掩不了殇 2024-07-19 06:05:35

这里有一些可以尝试的事情:

不要单独加载/编译每个类,而是加载两个类而不进行编译,然后立即编译它们。

像这样:

W $SYSTEM.OBJ.Load("C:\Test.Base.cls.xml")
W $SYSTEM.OBJ.Load("C:\Test.Extended.cls.xml")
W $SYSTEM.OBJ.CompileList("Test.Base.cls,Test.Extended.cls","ckf")

“k”标志告诉编译器保留生成的类源(.I​​NT 文件)。 这将使您看到缓存实际生成的内容(在 Studio 中:查看 -> 查看其他代码)。 您的方法被编译成以“z”为前缀的标签,因此方法 ABC 成为标签 zABC。 编译源代码中还有一个时间戳,可以帮助确认它确实做了一些事情。

“b”标志也可能有帮助。 (包括子类)。

Here are a couple of things to try:

Instead of loading/compiling each class separately, load both without compiling, then compile both at once.

Like this:

W $SYSTEM.OBJ.Load("C:\Test.Base.cls.xml")
W $SYSTEM.OBJ.Load("C:\Test.Extended.cls.xml")
W $SYSTEM.OBJ.CompileList("Test.Base.cls,Test.Extended.cls","ckf")

The "k" flag tells the compiler to keep the generated source for the classes (.INT files). That will let you see what Cache actually generated (In Studio: View->View Other Code). Your methods get compiled into tags prefixed with "z", so method ABC becomes tag zABC. There's also a timestamp in the compiled source that can help confirm that it actually did something.

The "b" flag might help too. (Include sub-classes).

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