Is it possible to NOT REFERENCE called programs from your main program.

Our existing NET EXPRESS system has a MAIN program in in called REPORTS.CBL.

Within the program there are calls made to upward of 100 potential bespoke report 'sub-programs'.

In Visual COBOL I've found that these 'sub-programs' must be mentioned in the REFERENCES of the main program otherwise the sub program will fail to load when called.

The problem is is that it takes an increasing amount of time to complie the VC COBOL version of the MAIN program as all the sub-program references are added.

Thirty references takes 3 minutes. Sixty takes 6 minutes and 100 references takes almost 10 minutes just to compile the program then another several minutes while it 'thinks' about doing a debug (if requested to do so!!)

Is there a way of calling out to other programs (.dll built) WITHOUT referencing them within the MAIN program as this would be a big help if there is!

 

  • It is not neccessary to add a reference to projects that contain programs that the main program will be calling but you do have to make the entry points to these programs available at run-time.

    These calls then become "dynamic" calls instead of "static" calls where they are known at compile time.

    You can do so by setting the environment variable PATH or COBPATH to include the folder where the .DLLs are located.
    If the entry point that you are calling is not the name of the .DLL then you have to preload the .DLL so that the run-time can find the entry point.

    This can be done using several methods including:
    1.   set procedure-pointer to entry "dllname"
    2.   MFENTMAP
    3.   Preload section of the app.config file.

    I wrote a number of tutorials on this subject and added them to the knowledgebase.
    There is a tutorial for each of the different types of code that can be called, i.e, managed-->managed, managed-->native, native-->native, etc.

    Please see the following for detailed information:

    Tutorial on using CALL statement in managed .NET code.

     

  • In the end I added an APP.CFG file to all my solutions which required call outs to DLLs.

    This had to contain the following code...

     <runtime>

       <loadFromRemoteSources enabled="true" />

     </runtime>

    The reson for this was that all our .DLL programs reside on the network drives and without this code the calling programs were unable to find the called programs and produced a runtime error when attempting to call them.

    Another item for the knowlege database methinks!

  • In the end I added an APP.CFG file to all my solutions which required call outs to DLLs.

    This had to contain the following code...

     <runtime>

       <loadFromRemoteSources enabled="true" />

     </runtime>

    The reson for this was that all our .DLL programs reside on the network drives and without this code the calling programs were unable to find the called programs and produced a runtime error when attempting to call them.

    Another item for the knowlege database methinks!

  • Verified Answer

    Actually, there is already a KB article that covers this.

    Please see the following:

    Call .NET managed code assemblies that are located on a network drive

    Be aware that this was a new option in the .NET Framework 4.0 and higher and is not supported if using a previous version of the .NET Framework.

    Thanks.

  • It appears that this link may be broken.
  • That link was to our old knowledgebase.

    The same article can now be found here: