views:

345

answers:

1

Hello

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

+1  A: 

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).

Clayton
Something like that worked for me. I load every class without compiling it and them compile all of them using the flags "fabr" (Force, include application classes,include subclasses,recursive).
Luis Soeiro