cppbestpractices icon indicating copy to clipboard operation
cppbestpractices copied to clipboard

More things you need to know on Windows

Open MikaelSmith opened this issue 10 years ago • 7 comments

How dependency lookup works (essentially, PATH) How to setup a multi-project environment (add things to PATH or use Vanagon and install everything to the same location)

MikaelSmith avatar Dec 03 '15 02:12 MikaelSmith

/cc @nicklewis please add any other issues you run into that might be helpful to explain here

MikaelSmith avatar Dec 03 '15 02:12 MikaelSmith

Describe Windows static (.a or .lib), shared (.so or .dll), import libraries (.so.a or .lib). Also why some projects use .so instead of .dll (Ruby's require).

CMake performs find_library lookup based on CMAKE_FIND_LIBRARY_PREFIXES and CMAKE_FIND_LIBRARY_SUFFIXES. On Windows (MinGW builds) those are lib and .dll;.dll.a;.a;.lib.

Link lines should use object files, then static libraries, then dynamic libraries. Otherwise symbols may not resolve correctly.

MikaelSmith avatar Dec 03 '15 02:12 MikaelSmith

DependencyWalker instead of ldd/otool.

MikaelSmith avatar Dec 03 '15 02:12 MikaelSmith

/cc @pcarlisle

MikaelSmith avatar Dec 03 '15 17:12 MikaelSmith

Should have similar notes for UNIX with PATH, LD_LIBRARY_PATH, rpath.

MikaelSmith avatar Dec 03 '15 21:12 MikaelSmith

Add notes on static vs shared libraries for all platforms. http://www.learncpp.com/cpp-tutorial/a1-static-and-dynamic-libraries/?

MikaelSmith avatar Dec 03 '15 22:12 MikaelSmith

Don't use long, it's size is platform-dependent.

MikaelSmith avatar Dec 03 '15 22:12 MikaelSmith