[Top][All Lists]

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

Re: [open-cobol-list] Undocumented cobc option: -static

From: Brian Tiffin
Subject: Re: [open-cobol-list] Undocumented cobc option: -static
Date: Tue, 18 Nov 2014 01:19:06 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0 SeaMonkey/2.30

Scott McKellar wrote:
There appears to be an undocumented option to cobc: -static.

Yeah, sorry I didn't speak up earlier.

It was hidden in the FAQ under CALL, unindexed sub-subdivision and not in the table of contents really.

In a few seconds, that entry will include a blurb on CALL STDCALL as well.

It is powerful voodoo that definitely needs more explaining.

Off topic, CALL STATIC is the only way to get at some libraries. GNU Prolog for instance.

Makes calling things like "puts", a no-brainer on Cygwin. Un-powerful cryptic voodoo otherwise. ;-)


So far as I can tell, this option tells cobc to translate CALL statements to 
static calls instead of dynamic calls.

However I only discovered that by trial and error.  A program that wasn't 
working without -static is now working with it.  I also examined the generated 
C code to verify that it's different.  I don't know what other effects -static 
may have.

However, -static is not listed among the compile options in the FAQ, nor in the 
corresponding page in Gary Cutler's book (I'm looking at the FAQ for GnuCOBOL 
v1.1 and the Cutler book for v2.0).  My only clue that -static was even 
available was that I saw it used in a couple of examples on the FAQ page.  I 
took a wild guess at what it did, and it looks like I guessed right.

I'm glad I found out about -static because the default of dynamic linking could 
have been a deal-breaker.  Without -static I couldn't find a way to link to a 
static library (a *.a file on a UNIX or Linux system).  Migrating to GnuCOBOL 
would be even more disruptive if we had to use dynamic linking everywhere.  It 
might not even be possible; for all I know we may rely on a third party static 
library somewhere that isn't available as a shared library.


Have I interpreted -static correctly?

Does -static have any other effects that I didn't notice?

Will -static be available in v2.0?  (I'm currently doing my explorations using 

Could someone please please document -static in the FAQ and wherever else is 

Scott McKellar

Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
open-cobol-list mailing list

reply via email to

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