Selective lib linking under Win32

  • Lester Ward

    Lester Ward - 2003-10-21

    I have the following situation, and am looking for information on how to properly format the cc command to take care of it under Win32.

    I have a directory (/foo) continaing a number of library files: a.lib, b.lib, c.lib, d.lib. I want to link to .only. a.lib and c.lib. From what I understand of the docs, I should use the following in the linker section:

    <syslibset dir="/foo" libs="a,c"/>

    This .probably. works under Linux, translating into the options -L/foo -la -lc.

    It does not work under Win32 at all, because (evidently) including a path in a syslibset tag under Win32s translates to "link to everything in this directory" and completely ignores the lib attribute. You can see in the debug output an attempt to link to a.lib b.lib c.lib and d.lib.

    This may be because the Win32 linker doesn't have a concept like -L and -l.

    I also thought to try:

    <syslibset libs="/foo/a.lib,/foo/c.lib"/>

    This results in .none. of the libraries being included in the link command.

    So, how do I do this?

    • saber850

      saber850 - 2004-04-19

      Interesting; I practically had the same problem.  Except my attempt would blow up since I had non-lib files in the dir (MS's lib didn't like those).
      Unfortunately, I couldn't reproduce the problem in a simple test setup, and the problem vanished.
      Is it possibly related to relative vs absolute paths (basically the only thing that changed in my setup)?


Log in to post a comment.