wiki:kOptions

GCC on OS/2 supports several extra options. Most start with -Z. With the exception of -Zomf (others?) they are affecting the linking.

  • -Zcrtdll: link the C library dynamically
  • -Zdll: create a dynamic link library
  • -Zexe: create foo which is executable which calls foo.exe which is also created.
  • -Zhigh-mem: link so that the C library calls in the program make use of "high memory". This is similiar to specifying OBJ_ANY to OS/2 API memory calls. If you use this option you should include os2safe.h as the first include file in every C file that uses OS/2 APIs.
  • -Zlinker: pass option through to linker (like -Zlinker /EXEPACK:2 -Zlinker /PACKCODE)
  • -Zmap: tell linker or emxbind to create a .map file that contains the addresses of all symbols
  • -Zno-autoconv: switch off automatic conversion between a.out and OMF format when linking.
  • -Zautoconv: switch on automatic conversion between a.out and OMF format when linking.
  • -Zomf: compile and link using OMF format instead of a.out.
  • -Zargs-wild: call _wildcard() (see below) automatically on startup
  • -Zargs-resp: call _reponse() (see below) automatically on startup
  • -Zbin-files: open files in binary mode by default
  • -Zdll-search: Enables dlls as valid libraries. (default disabled)
  • -Zstack: set the stack size
  • -Zsym: Invoke mapsym.cmd on the mapfile to produce a .sym file. Requires -Zmap

These may not be OS/2 specific

  • -Bstatic, -non_shared, -dn, -static: Link with static libraries.
  • -Bshared, -call_shared, -dy: Link with shared libraries. (default)

These are mentioned in ReleaseNotes?.os2 but not sure what they do exactly:

  • -Zhigh-low: ??
  • -Zno-fork: turn off the fork() function?
  • -Zno-unix: non-unix like mode, affects slash handling and fork()?

These were supported options with EMX/gcc 2.8.x, not sure if they are still supported now:

  • -Zbsd-signals: select the `BSD' signal processing model
  • -Zmt: multithread code (now default)
  • -Zmtd: multithread code, link C library dynamically
  • -Zmts: multithread code, link C library statically
  • -Zno-rte: create DLL without runtime environment
  • -Zsmall-conv: use small, fast, and inaccurate routines for converting decimal numbers to binary and vice versa
  • -Zso: create stand-alone DLL
  • -Zsys: create stand-alone OS/2 program (no emx.dll) - there's nothing similar for current libc, if you use new gcc with new libc, you always need the libcxxx.dll
  • -Zsysv-signals: select the `System V' signal processing model

There are also various environmental variables that affect the linker type. (from the output of emxomfld 0.6.3)

Environment variables:

EMXOMFLD_TYPE:

The type of linker we're using. Values: WLINK, VAC365, VAC308, LINK386.

WLINK wlink.exe from Open Watcom v1.5 or later. VAC365 ilink.exe from IBM C and C++ Compilers for OS/2 v3.6 or later. VAC308 ilink.exe from Visual Age for C++ v3.08. LINK386 link386 form OS/2 install or DDK.

EMXOMFLD_LINKER:

Name of the linker to use and optionally extra parameters. Spaces in the linker name or path is not supported. Quotes are not supported either.

The default values for these two variables are VAC365 and ilink.exe.

EMXOMFLD_RC_TYPE:

The type of resource compiler we're using. Values: RC,WRC.

RC rc.exe as shipped with OS/2 or found in the Toolkit WRC wrc.exe from Open Watcom v1.6 or later.

EMXOMFLD_RC:

Name of the resource compiler to use and optionally extra parameters. Spaces or quotes in the name or path are not supported.

The default values for these two variables are RC and rc.exe. Finally, there are a couple of special functions which simplify porting of Unix programs:

  • _wildcard (int *argc, char ***argv): Same as in EMX, i.e. it expands it's arguments like a unix shell would do (but OS/2 cmd.exe doesn't), so you typically want to use this when porting a unix command line application. Instead of adding this to a program, compilation with -Zargs-wild can be used.
  • _response (int *argc, char ***argv): Same as in EMX. Expand response files (@FILENAME). The FILENAME contains a list of arguments, one per line. Arguments enclosed in double quotes will not be expanded. If a response file can not be opened, the argument is kept the same. -Zargs-resp will automatically compile this in.
Last modified 4 years ago Last modified on Feb 11, 2011, 3:03:17 AM