cobc hello.cob
is identical to cobc -m hello.cob
, from cobc --help
:
-x build an executable program
-m build a dynamically loadable module (default)
A ".so" file is a shared library, so nothing you commonly want to execute, because most shared libraries don't have a "main" symbol entry point.
... but you've followed some docs, I guess those are heavily outdated and may were working that way around 2002 /´(mind the URL "historical/open-cobol"). You likely want to have a look at the manual, if you don't want to execute "info gnucobol" you may want to have a look at its simplest all-in-one-HTML form: https://gnucobol.sourceforge.io/doc/gnucobol.html and in any case you likely want to check out the GnuCOBOL Programmer's Guide
If you want to execute hello.so use cobcrun hello
(GnuCOBOL's module loader).
Comments don't work with cobc -x -free hello.cob
as the file is a fixed-form reference-format (in which line-comments start with *
in the indicator column = 7) and you told cobc to handle it as free-form reference-format (which has no indicator column at all and where comments start in any position with *>
).
From cobc --help
:
-F, -free use free source format
-fixed use fixed source format (default)
Also is very rare that cobc generates an .so file and not an .a file.
Yes, that's rare on GNU/Linux, but you can have it your way: cobc -x -o hello.a hello.cob