Re: Confusion calling subprograms

From: Richard (riplin_at_Azonic.co.nz)
Date: 07/14/04


Date: 13 Jul 2004 15:17:42 -0700

Andy <andy@dontbother.com> wrote

> I'm using MF Cobol on Solaris and I'm trying to get one program to call
> a function in another program but I keep getting linker errors. Ideally
> the function I was calling would reside in a shareable library (.so) so
> that multiple applications could access it.

What is it that you are calling a 'function' ?

If it is a nested program, then you cannot call that directly as all
nested programs are local to the compile unit it is contained in. You
could call the containing program with parameters to indicate that it
should call the nested program and pass back the results.

Or you could add an ENTRY statement in that compile unit which calls
the 'function' and returns. Note that an ENTRY is not a paragraph
label so do be careful that you don't get a drop-through into this.

The fact that you are getting 'linker errors' indicates that you are
not using dynamic calls. There is a compiler option that indicates
whether CALL "literal" should be a static call or a dynamic one.
 
> Does anybody have a noddy example of how to write and build such a system?

Yes, I have several.



Relevant Pages

  • Re: Confusion calling subprograms
    ... What is it that you are calling a 'function'? ... If it is a nested program, then you cannot call that directly as all ... Or you could add an ENTRY statement in that compile unit which calls ... The fact that you are getting 'linker errors' indicates that you are ...
    (comp.lang.cobol)
  • Re: Confusion calling subprograms
    ... What is it that you are calling a 'function'? ... If it is a nested program, then you cannot call that directly as all ... Or you could add an ENTRY statement in that compile unit which calls ... The fact that you are getting 'linker errors' indicates that you are ...
    (comp.lang.cobol)