gnucobol-users
[Top][All Lists]
Advanced

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

Re: [open-cobol-list] calling std c library calls from cobol and cob_in


From: Keisuke Nishida
Subject: Re: [open-cobol-list] calling std c library calls from cobol and cob_inspect_tallying() segmentation violation
Date: Wed Jun 5 03:23:05 2002
User-agent: Wanderlust/2.6.0 (Twist And Shout) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (Unebigoryƍmae) APEL/10.3 Emacs/21.2 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

Hi Richard,

Probably we should define the meaning of each option more carefully.

The compiler options you use are categorized into one of the
following three:

o Options that specifies compile target

  -E        generates *.i
  -C        generates *.c
  -S        generates *.s
  -c        generates *.o
  -m        generates *.so
  (none)    generates executable

o Options that specifies whether the program has main() or not

  -m        no main()
  (none)    have main()

o Options that specifies how CALL statements work

  -static   static function call
  -dynamic  dynamic call using cob_call_resolve

The confusing point is that `-m' has two meanings: generating
a shared object and inhibiting main().  I guess we should
separate these concepts into different options.

What about adding the following option?

o Options that specifies whether the program has main() or not

  (none)    no main()
  -main     have main()

With this definition, you will always obtain no-main code
unless you give `-main' to cobc explicitly.  Options -c and -m
are now competitive; you can use only one of them at once.

Building an executable without -main is now an error.
I guess this reduces the confusion we have had.

I will implement this option in the next version.

Keisuke


At Wed, 05 Jun 2002 01:10:06 -0600,
Richard A. Painter <address@hidden> wrote:
> 
> i am using 0.9.5.91...
> 
> when i do "cobc --help" it reports that the -m means "build a dynamic-linking
> module".  from what you say this must be wrong.
> 
> 1. this version does NOT produce a .so file!  i'm certain 0.9.5 release did
> produce .so by default and a .o when using -static.  i did not run the test i
> have run here on the released version.
> 
> 2. what does the following really mean?
> XMLINPUT.cob:221: warning: compiled as a module due to USING clause
> XMLINPUT.cob:221: warning: use compiler option `-m' explicitly
> 
> it seems that the warning says the module compile mode was used BECAUSE it 
> had a
> USING, not because it had no main().
> 
> 3. yes, i do have PROCEDURE DIVISION USING and when i cobc i get the following
> results.  when i use the -m the 2-line warning goes away.  however, i never 
> get
> the .so for the dynamic:
> 
> (linux1 src/magnum 915) cobc -c XMLINPUT.cob
> XMLINPUT.cob:221: warning: compiled as a module due to USING clause
> XMLINPUT.cob:221: warning: use compiler option `-m' explicitly
> 
> (linux1 src/magnum 916) ls
> CCCCOPY   ML122PM     Orig/        XMLINPUT.c    hello*
> CLICENSE  NCB70INQ    TESTXML*     XMLINPUT.cob  testmagcob
> CMLTAD          NCB70INQ.sav  TESTXML.cob  XMLINPUT.o    typescript
> COPYRGHT  Old/                XMLINPUT     bin/
> 
> 
> 
> (linux1 src/magnum 917) cobc -c -static XMLINPUT.cob
> XMLINPUT.cob:221: warning: compiled as a module due to USING clause
> XMLINPUT.cob:221: warning: use compiler option `-m' explicitly
> 
> (linux1 src/magnum 918) ls
> CCCCOPY   ML122PM     Orig/        XMLINPUT.c    hello*
> CLICENSE  NCB70INQ    TESTXML*     XMLINPUT.cob  testmagcob
> CMLTAD          NCB70INQ.sav  TESTXML.cob  XMLINPUT.o    typescript
> COPYRGHT  Old/                XMLINPUT     bin/
> 
> 
> 
> (linux1 src/magnum 919) cobc -c -m XMLINPUT.cob
> 
> (linux1 src/magnum 920) ls
> CCCCOPY   ML122PM     Orig/        XMLINPUT.c    hello*
> CLICENSE  NCB70INQ    TESTXML*     XMLINPUT.cob  testmagcob
> CMLTAD          NCB70INQ.sav  TESTXML.cob  XMLINPUT.o    typescript
> COPYRGHT  Old/                XMLINPUT     bin/
> 
> 
> 
> (linux1 src/magnum 922) cobc -c -dynamic XMLINPUT.cob
> XMLINPUT.cob:221: warning: compiled as a module due to USING clause
> XMLINPUT.cob:221: warning: use compiler option `-m' explicitly
> 
> (linux1 src/magnum 923) ls
> CCCCOPY   ML122PM     Orig/        XMLINPUT.c    hello*
> CLICENSE  NCB70INQ    TESTXML*     XMLINPUT.cob  testmagcob
> CMLTAD          NCB70INQ.sav  TESTXML.cob  XMLINPUT.o    typescript
> COPYRGHT  Old/                XMLINPUT     bin/
> 
> 
> 
> (linux1 src/magnum 924) cobc -c -m -dynamic XMLINPUT.cob
> 
> (linux1 src/magnum 925) ls
> CCCCOPY   ML122PM     Orig/        XMLINPUT.c    hello*
> CLICENSE  NCB70INQ    TESTXML*     XMLINPUT.cob  testmagcob
> CMLTAD          NCB70INQ.sav  TESTXML.cob  XMLINPUT.o    typescript
> COPYRGHT  Old/                XMLINPUT     bin/
> 
> 
> 
> rich
> 
> 
> Keisuke Nishida wrote:
> > 
> > At Tue, 04 Jun 2002 09:31:03 -0600,
> > Richard A. Painter <address@hidden> wrote:
> > >
> > > 1. i want to use static linking however, when i try to use -static
> > > cobc complains telling me i must use -m since i use CALL USING.  is
> > > this true that dynamic linking MUST be used if one uses CALL USING?
> > 
> > No.  The compiler shows the warning when you use
> > PROCEDURE DIVISION USING, not CALL USING.  All the `-m' option
> > implies is that the program does not have main() function.
> > It should be independent of the -static/-dynamic options.
> 
> _______________________________________________________________
> 
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
> 
> _______________________________________________
> open-cobol-list mailing list
> address@hidden
> https://lists.sourceforge.net/lists/listinfo/open-cobol-list
> 



reply via email to

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