Visual COBOL for Visual Studio Getting Started with Solutions, Projects and the COBOL CALL Statement - INT/GNT
I am having trouble setting up my Visual COBOL Solutions and Projects so that I can make calls from programs residing in one project to programs residing in different projects.
Is there a Tutorial available which will familiarize me with the steps neccessary to do this?
Attached to this article is a tutorial called Visual COBOL CALL - INT-GNT Tutorial.pdf.
There are a number of KB articles in this tutorial, one for each type of call:
1. Native to native
2. INT/GNT to INT/GNT
2. Managed to managed
3. Native to managed
4. Managed to native
This article covers INT/GNT code to INT/GNT code.
Problems with Calling Programs Located in Different Projects
Each project specifies an output folder into which its generated output files will be stored.
The default name of this folder varies depending on the project CPU settings and which build type you are using such as DEBUG or RELEASE.
The default location is in a subfolder which is relative to the projects main folder, i.e., .\bin\x86\debug.
This default name of the output folder is configurable under the COBOL tab of the Project Properties page.
There are two issues that need to be addressed when a program in one project calls a program in another project.
1. Programs that are called cannot be found.
When an application is started in Visual Studio the output folder in which the main application resides will become the current folder.
Programs that are called must either be placed in this startup folder or all programs must be placed in a different folder or they must reside in a folder that is locatable via environment variable PATH.
2. Entry points that are called that are different from the name of the .DLL cannot be found.
When the name of the program in the call statement matches the name of the .DLL on disk then it will be found as long as the conditions in 1 above are true.
But if calling an entry point which is the name of another program within the .DLL or the name of an entry point specified in an ENTRY statement within a program in the .DLL, the .DLL containing the program to be called must be preloaded in order to make its entry points visible to the run-time system.
This can be done using one of the following methods.
- set proc-pointer to entry “dllname”
- Micro Focus Entry Name Mapper (MFENTMAP)
- Interop Preload section of app.config file (managed code only)
All of these scenarios will be covered in the tutorials that follow.