如何制作 Intersystems Caché 使用新编译的类而不是旧的类?
我在加载和编译现有类的新版本时遇到问题。 在加载它们时,没有任何对它们的引用。 “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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有一些可以尝试的事情:
不要单独加载/编译每个类,而是加载两个类而不进行编译,然后立即编译它们。
像这样:
“k”标志告诉编译器保留生成的类源(.INT 文件)。 这将使您看到缓存实际生成的内容(在 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:
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).