In the Extremely Weird Department:

I am moving some code around to better organize it. Before I move anything, everything works fine, as it has for several years.

I have a general procedures prg file that contains a class definition for a form. It's nothing special: DEFINE CLASS myform AS Form, a few custom methods, that's it.

I comment out the class definition in my general procedures file and put it into a different prg file.

I run my program. As the program starts up it calls a procedure that's in the general file that is completely unrelated to this form class definition. This procedure works fine.

As the program shuts down, it calls the same procedure in the same general file. This time I get Error 1, because the program has already cleared memory and SET("PROCEDURE") returns an empty string.

BUT... If I go back and uncomment the form class definition in the general file (and comment it in the place I moved it to), then when the program shuts down, SET("PROCEDURE") still contains that procedure file and the program exits properly.

The program compiles fine with no errors.

I have tried copying everything out of the general prg file to an ordinary plain text file, completely removing the commented-out code, then creating a new general prg file and putting the code back in. No help.

I have also tried moving the order in which procedure files are added with SET PROCEDURE TO ... ADDITIVE, to make sure the general prg file is added before the class definition that calls the problem procedure is added to SET CLASSLIB TO ... ADDITIVE. This shouldn't make any difference because VFP is supposed to search the entire "path" for this stuff before giving up. And it doesn't make any difference in my tests.

The only other relevant point is that there is a procedure in the general file that instanciates that form class. That procedure comes right after the one that fails when the program exits. However, I also commented that procedure out and moved it and that didn't cause any problem. It's only when I comment out the form class file that the problem occurs.

And I emphasize--the procedure in the general file that uses the form class, and the form class definition itself, both moved elsewhere, still work fine. It is the completely unrelated procedure that comes before the commented procedure that errors out.

I realize this is complicated to explain. So here's a very simple example:

---- General.Prg

PROCEDURE One
code, etc.
ENDPROC

* If the class definition at the bottom of this file is commented out,
* this procedure works at program startup, but during program shut
* down, it bombs out with Error 1 ("file not found"), because
* SET("PROCEDURE") returns "" at that time.
*
* If the class definition at the bottom of this file is not commented
* out, then at shut down, SET("PROCEDURE") returns this prg file
* (among many others), and this procedure runs just fine.
PROCEDURE Two
code, etc., entirely unrelated to anything else.
ENDPROC

* This procedure has been moved elsewhere, where it works just
* fine under all circumstances. (It is only used in isolated
* circumstances, and the form is not in existence during the
* shutdown process.)
*PROCEDURE Three
* oForm = CREATEOBJECT("MyForm")
*
* code, etc.
*ENDPROC

PROCEDURE Four
code, etc.
ENDPROC

* This class has been moved elsewhere, where it works just fine.
* However, commenting it out here causes a call to Two(), above,
* to fail during shutdown because the entire procedure file, as
* well as every other procedure file, has been removed from memory
* at the time.
*DEFINE CLASS Myform AS form
* code, etc.
*ENDDEFINE
**** End general prg file

I can live with not re-organizing the files. But this is very strange and it implies that something more serious is wrong somewhere.

Any suggestions would be welcome.

Thanks.

Ken Dibble
www.stic-cil.org


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to