Being a long-time POSIX/Linux/BSD C developer and now trying to do a few things with Visual C++ 2010, I’m kind of fumbling around with the tooling because it doesn’t quite work the same as the GCC toolset does. In theory, at least according to the docs, it seems very similar (and I’m sure it is), but I’m not seeing the things I’m expecting to see.
In this case, I’m trying to build a C library for later use in a .NET project, and I want to be careful to avoid runtime conflicts later on. My thought was to build a static library, linked against a DLL version of the C runtime (msvcr100d.dll in the Debug config) so I set the /MDd flag. However, when I use dumpbin.exe to inspect the resulting .lib output, it shows no dependents or imports.
Two questions, really:
- Is this a bad idea in the first place? Should I be building a DLL or linking against the static CRT instead?
- Why doesn’t
dumpbin.exeshow the dependency on the CRT when I use/MDd?
Update: Choosing the Correct C/C++ Runtime Library is pretty helpful and informative. I tried the dumpbin incantation he suggests, and the output shows that the lib does link to msvcrtd as expected, but that doesn’t really answer my second question above.
Because this is not a final EXE or DLL there is no import section. Instead, there are linker directives that say how this lib would like to be linked.