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_i


From: Richard A. Painter
Subject: Re: [open-cobol-list] calling std c library calls from cobol and cob_inspect_tallying() segmentation violation
Date: Wed Jun 5 08:52:42 2002

historically, -c means compile only.  so this would apply to BOTH .o and .so. 
since you have separated this you have departed from what the vast majority (me
included) would expect.

why does cobc need to have a -main like option?  for example, cc or gcc when
using the -c doesn't care whether you have a main or not and you don't have to
tell them.

how about using
        -c for compile only (either .so or .o)
        -E        generates *.i
        -C        generates *.c
        -S        generates *.s
        none of the above gens executable (and expects a main to link)

        -static forces .o
        -dynamic (default if you like) forces .so


since using -dynamic and -static you don't need the -m to determine .o vs. .so
you can still use the -m for just the main, no main flag.  BUT i still dont see
why this is needed at all.

thanks,
rich



Keisuke Nishida wrote:
> 
> 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
> >
> 
> _______________________________________________________________
> 
> 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

-- 

+---------------------------------------------------------------+
| Richard A. Painter            Phone 719 495 7054              |
| Painter Engineering, Inc.     Mailto:address@hidden       |
| 8470 Swan Rd.                                                 |
| Black Forest, CO 80908                                        |
|                                                               |
| Visit our Web site:         http://painter.inc                |
|         http://home.earthlink.net/~painterengineering         |
|                                                               |
| Systems & Software Engineering + LAN WAN Networking + X.25    |
| INTERNET TCP-IP + Real-time Transaction Processing            |
| System & Software Integration, Testing, Verification & Audits |
| Web Hosting & Design + Apache + PHP + modSSL + cURL           |
| Database Design & Applications + Oracle                       |
| Benchmarks + Course & Workshop Development & Delivery         |
| Financial and Medical Software Integration + Security         |
| Middleware + EDI + Cryptography + Firewalls                   |
| UNIX + Linux + Windows                                        |
|                                                               |
| What is popular is not always right and what is right is not  |
| always popular.     - Howard Cosell                           |
|                                                               |
| Chance favors the prepared mind!   Illegitima non carborundum |
+---------------------------------------------------------------+



reply via email to

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