Version 2 (modified by guest, 13 years ago) (diff)

Added some (hopefully correct) details about wildcard handling

GCC on OS/2 supports several extra options. They all 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: touch output file, add .exe extension
  • -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.
  • -Zomf: compile and link using OMF format instead of a.out.

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

  • -Zargs-wild: something with wildcards - call _wildcard (see below) automatically on startup?
  • -Zargs-resp: ??
  • -Zdll-search: ??
  • -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:

  • -Zbin-files: open files in binary mode by default
  • -Zbsd-signals: select the `BSD' signal processing model
  • -Zmt: multithread code
  • -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
  • -Zstack: set the stack size
  • -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

Finally, there are a couple of special functions which simplify porting of Unix programs:

  • _wildcard (int * argc, charargv): 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. BTW, is there code to try and detect the calling shell, to avoid double expansion when a unix shell is used? I seem to remember that EMX did something like that?