order of arguments on command line when linking

Erik Poupaert erik.poupaert@chello.be
Thu Feb 13 04:13:00 GMT 2003

When I change the order of arguments on the command line when linking, I may
get linking errors, which can be solved by changing the order of the
arguments. For example, I know the following won't work:

gcj -s -fCLASSPATH=cls libexample.a libswtwin32.a  libswtjniwin32.a
swt-win32.exp ...

I have to put the swt-win32.exp argument first:

gcj -s -fCLASSPATH=cls swt-win32.exp libexample.a libswtwin32.a
libswtjniwin32.a  ...

Sometimes it simpler than that:

gcj lib1.a lib2.a ... won't work. It must be: gcj lib2.a lib1.a ...

Is there a reason for this?

More information about the Java mailing list