This article was previously published under Q102586
This article has been archived. It is offered "as is" and will no longer be updated.
When you are building an application (.APP) from a project that makesreference to a function or procedure that is contained within anotherapplication, FoxPro is unable to resolve the external reference. TheBuild function will display the following error message:
Unable to Find Proc./Func. <name>
At the bottom of the file, create a procedure stub that references theexternal function.
Additional ways to resolve this problem and their advantages anddisadvantages are explained at the end of the "More Information"section below.
NOTE: Using the EXTERNAL PROCEDURE <name> compiler directive does notresolve the problem.
The code example below demonstrates this error. Because the main .APPfile makes reference to a procedure stored in another .APP file, theBuild function is unable to resolve the reference.
Open a new program file. Name it SUBAPP.PRG and include the following code:
PROCEDURE MyFunc WAIT WINDOW 'Myfunc called.'
Save the program, and include it in a new project named SUBAPP.PJX. Save the project, and build an application named SUBAPP.APP.
Create a file named MAINAPP.PRG. Include the following code:
EXTERN PROCEDURE MyFunc DO MyFunc IN SubApp.app
Save the program and add it to a new project named MAINAPP.PJX. Save the project and build an application named MAINAPP.APP.
During the build, as FoxPro is attempting to resolve external references, an alert will appear with the following text:
Unable to Find Proc./Func. MYFUNC Locate, Ignore, Ignore All, Cancel
In the alert box, choose Locate and choose SUBAPP.APP, which contains the procedure MyFunc. FoxPro will add the application as an excluded application to the project MainApp and complete the build. Run MAINAPP.APP, and the wait window will appear with the text "MyFunc called."
Rebuild MAINAPP.PJX. Note that once again the "Unable to Find Proc./Func." alert appears. Attempting to locate SUBAPP.APP again will add yet another copy of the application as an excluded application to the project. You can choose Ignore instead, and FoxPro will rebuild MAINAPP.APP without error.
You can resolve this problem in one of three ways:
Choose Ignore when the Locate alert appears every time you rebuild your project. -or-
Remove the reference to SUBAPP.APP from the MAINAPP project, pack the project, and add a reference to the source program, in this case SUBAPP.PRG, which contains the source code for the procedure MyFunc. -or-
Add the following code to the end of MAINAPP.PRG:
This is a procedure stub that helps FoxPro resolve the external reference. Since the line of code that actually calls the procedure explicitly specifies the file in which the procedure actually resides, it is that procedure (in this case, the procedure in SUBAPP.APP) which will be called.
Both the second and the third options will eliminate the problem.However, while the second option requires the source code to beavailable and that it be built into the application, increasing itssize, the third option requires that the entire called applicationthat includes the single function be sent along with the callingapplication. If the source code to the function is not available, andyou would like to avoid the alert box, use the third method.