0

I have a class library in Visual FoxPro (.vcx file). After I edit the code contained within it, and then run my application, I get an Error 1309 '[class library name] is not an object file'.

This is after the class has been instantiated, and happens at the point that a class within the .vcx calls a method within itself. So it is indeed an object at that point, because the line of code that causes the error is contained within the class library.

I have noticed that whenever I edit and save the .vcx, if I open the .vcx as a table I can see that there are two deleted rows pertaining to the class that generates the error. If I PACK the .vcx and run the program, I get no error. Similarly, if I COMPILE CLASSLIB [class library name], I get no error.

2 Answers2

1

Is it possible that the VCX is corrupted? Can you try doing a "Save As" and test the VCX again?

Jerry
  • 6,357
  • 8
  • 35
  • 50
  • The menu option to 'Save As...' is greyed out in VFP when I try to access it for the .vcx itself and any classes contained within it. I have also tried this with other .vcx's with the same result. –  Apr 12 '13 at 15:52
  • 2
    A VCX is just a DBC with a special extension. You can USE it and then use COPY TO to make a copy. You'll probably have to change the extensions of the copied files. – Tamar E. Granor Apr 12 '13 at 20:46
  • @Tamar Thanks, I have just tried opening as a .dbf, then COPY TO. After editing and saving, then running the application, I get the same Error 1309. –  Apr 15 '13 at 09:13
1

you could try to recompile the class library. The class library has both a column for the code (as raw text), and another column for the OBJECT COMPILED Code in another. It COULD be as simple as

compile class (yourClassLibrary)

This will rebuild the objcode column for you for all the records within the classlib.

If the .vct (.fpt memo portion) of the file is corrupt, then you'll be in a harder position of possible recovery.

DRapp
  • 47,638
  • 12
  • 72
  • 142
  • Unfortunately my current workaround is to COMPILE CLASSLIB [myClassLibrary] every time I edit and save. If I don't do this, then I get the error. –  Apr 15 '13 at 08:56
  • @wilbishardis, how are you doing the editing... are you doing it directly from within the .vcx or through the IDE. Are you hooked up to some source code control program? – DRapp Apr 15 '13 at 10:50
  • I am working through the IDE. The .vcx is part of a project, so from the 'Classes' tab on the project, I expand the .vcx and double-click the class to edit it. Also, if I edit the class through Tools / Class Browser in VFP I also get the same issue. –  Apr 15 '13 at 11:54