[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] Re: feature request: implementation "IS EXTERNAL"

From: Thomas Biehler
Subject: Re: [open-cobol-list] Re: feature request: implementation "IS EXTERNAL" (semantics)
Date: Thu Dec 4 16:04:08 2003
User-agent: KMail/1.4.3

On Friday 14 November 2003 12:40, Keisuke Nishida wrote:
> At Tue, 11 Nov 2003 17:17:31 +0100,
> Thomas Biehler wrote:
> > i have tested it with no success.
> Gee, I misunderstood the effect of EXTERNAL.  What I did is to
> declare the field as an external variable in C.  The field is
> not actually defined, so the undefined reference error happened.
> It seems a field with EXTERNAL should have both a declaration
> and a definition.  How can I implement this?  In C, there must
> be only one definition even if you compiled several modules.
> Hmm, maybe we need to generate a special module for external
> variables, or we need to resolve the field at run time.
> Keisuke

hi keisuke,

I have a found a simple solution. 
A BIG surprise for me!
It is NOT far away from the current trial!

To say it short:  (the components of the solution which improve your trial)
  1. the ANSI C 89  "tentative definition"  for the "EXTERNAL GROUP-FIELD"  
     (the key "feature";  have a look on my comments in the c-sources!)
  2. no initialization of the data members of the "EXTERNAL GROUP-FIELD"
     (at least  NO initializiation in a "subprogram")
  3. a (unsigned char *) cast to make the C-Compiler quiet ;-)
To demonstrate the solution, 
i have attached a uncompressed tar-Archive (40 KB) which contains:
in the subdir "externalpatch" :
  - two Cobol-mainprograms: EXTERNALBUG.cob  and EXTERNALBUG2.cob
  - two Cobol-subprograms: UPROG.cob and UPROG2.cob
  - the patched "cobc -save-temps ..." output from the compiliation
        from the previous COBOL-program (*.c, *.c.h) 
    ==> the "solution" and explaining comments are in that versions
in the topdir:
  - a unified patch:   is_external.patch
    You can get the original (unpatched) output from the 
     "cobc -save-temps ..." invocation with
         patch -p1 -R < ../is_external.patch 
     in the (copied) "externalpatch"-directory

Could you please implement it "soon" ?   ;-)

It's easy, isn't it ?  


Attachment: externalpatch.tar
Description: Unix tar archive

reply via email to

[Prev in Thread] Current Thread [Next in Thread]