How do I pass -( option to the linker?

Because of a circular reference in my code, I need to tell the linker to
search a library repeatedly via the -( option. How do I pass this option
to the linker from qcc? Using Momentics Professional under Windows, version
6.3

Also, is there a way under the QNX Momentic IDE to specify a new library
project composed of other libraries instead of .c/.cpp files?

Richard Doucet <doucetr@aecl.ca> wrote:

Because of a circular reference in my code, I need to tell the linker to
search a library repeatedly via the -( option. How do I pass this option
to the linker from qcc? Using Momentics Professional under Windows, version
6.3

In general, if qcc doesn’t support an option itself, you can use the -W
option to pass an option to the underlying compiler, linker, etc. Specify it
like this:

-W phase,arg[,arg …]

where “phase” is one of:

p – preprocessor
c – compiler
l – linker
a – assembler.

So, I expect you’d pass your -( option like this:

-W l,-(

(but you might have to quote it).

Also, is there a way under the QNX Momentic IDE to specify a new library
project composed of other libraries instead of .c/.cpp files?

I’ll leave this question for someone else to answer.


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

Steve Reid wrote:

Richard Doucet <> doucetr@aecl.ca> > wrote:

Also, is there a way under the QNX Momentic IDE to specify a new library
project composed of other libraries instead of .c/.cpp files?

I’ll leave this question for someone else to answer.

I just tried this:

  1. create “Standard Make C” project
  2. copied two lib*.a files into the project’s workspace directory
  3. picked Refresh from the project’s context menu
  4. created a Makefile thusly:

all: libfoo.a

libfoo.a: libsnmp.a libsocket.a
-mkdir lib1 lib2
( cd lib1 ; ntox86-ar -xv …/libsnmp.a )
( cd lib2 ; ntox86-ar -xv …/libsocket.a )
ntox86-ar -rcsv libfoo.a lib1/.o lib2/.o

clean:
rm -f libfoo.a
rm -rf lib1 lib2

Which created a libfoo.a filled with all the .o files from libsnmp.a and
libsocket.a.

There’s probably a clever(er :slight_smile: way of doing this by passing options to
the linker, but I couldn’t find the “keep all objects from a library in
the output” option.


Chris Herborth (cherborth@qnx.com)
Never send a monster to do the work of an evil scientist.