Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I use a particular version of a prg? 1

Status
Not open for further replies.

cfsjohn

Programmer
Sep 1, 2016
59
0
6
US
I use west-wind web connection libraries a lot. I have some programs that are many years old and that use older versions of some of west-wind's prg's. I am writing a new program. It must use the latest version of a few of the west-wind prg's. So that I do not adversely effect those older programs, I need to tell my new program to use the newest versions of west-wind's prgs. That is such a twisted loop of a conversation so let me try to be more specific.

I have a project that uses wwapi.prg, wwhttp.prg, wwutils.prg and wwxml.prg. These files are included in the project. They have been used for many years. The project has to continue using these old versions of these prgs.

I am adding a new prg to this same project. Somewhere in this new prg I need to say:
do wwapi (but run the latest version)
do wwhttp (but run the latest version)
do wwutils (but run the latest version)
do wwxml (but run the latest version)
Do some stuff
set everything back so these newer versions of these 4 prgs are unfindable
return

How would I do that? I know it may be something like set procedure to ... additive but not sure at all. This type of procedures and libraries and environment stuff has never by my strong suit.
Thanks,
John
 
It may not be impossible to combine several versions of web connection, it shouldn't be hard to upgrade all usage to one version. I'd not even try to mix old and new versions.

To still answer your direct question, if files have the same name you're unlucky, within the IDE you can of course address a specific file, but including both a version A and a version B prg, the final EXE will not enable you to distinguish them. So you'd need to start excluding these PRGs to work around that, not a nice perspective.

Using SET PROCEDURE just helps VFP to find PRGs without needing to address the full path, that's not helping you at all, contrary to what you like to achieve it would introduce the problem you have in a final EXE to the IDE environment. Since I know west wind programs use SET PROCEDURE within their code, that's actually something that makes using two different versions harder rather than simpler, even if you yourself address the specifc file in your code, usage of a prg usually does SET PROCEDURE to itself.

So, again, you better upgrade code to make use of the latest versions overall. It shouldn't at all be as much work as you fear it is, because of compatibility.

As an aside, that won't help you: With different DLL versions used by DECLARE DLL you have AS Aliasname with SET CLASSLIB you have AS Aliasname, with SET PROCEDURE you don't have that mechanism for differentiation.

Problems already start if you try to include two PRGs of the same name in two directories. What still works within the IDE then fails to build. VFP clearly doesn't like this kind of parallel usage of different versions of the same libraries and you'd need to cater for it by programming respectively, with version numbers in the class/function/procedure names, for example. I doubt anybody would like a library that instructs you to CLEAR PROGRAMM and/or CLEAR CLASS and/or even CLEAR CLASSLIB after any single call of a function or instantication of a class to let VFP forget what it buffers for usually faster usage, just so that changing to another VCX or PRGR with essentially the same things in older or newer versions does use them instead of what was first used.

Chriss
 
Thanks Chris, Well your solution is the SMART solution albeit, yes I do dread it. It would be a much better world if I just suck it up and get that done. I'll set down that path. Thanks and have a good day,
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top