I want to combine a list of libraries into a single one (static libraries, not import libraries)
I am using something like this to do so:
lib /OUT:mylib.lib a.lib b.lib c.lib d.lib
But wonder how can I do the same for the pdb files of those libraries.
Ideally I would like to end up with two files.
mylib.lib
mylib.pdb
Its the linker that creates the .pdb files, so when linking obj/libs to create a dll or exe it should create a pdb file then if specifed to do so, like so
LINK.EXE /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /PDB:"MyApp.pdb"
which would create a MyApp.pdb file for a MyApp.exe
So it should contain private symbols and lines for a debugger to use, that includes all the functions that your program uses that are pulled in from the libs you compiled it with
I dont think there is a way to pre-create pdb files for specific libs and/or combine them. The pdb that you can download from microsoft are usually for specific dll's used - user32.pdb for user32.dll, advapi32.pdb for advapi32.dll etc etc. Windows symbols can be downloaded from here: https://msdn.microsoft.com/en-us/windows/hardware/gg463028.aspx
So you can create your own pdb for your MyApp.dll or MyApp.exe and/or use ms ones for particular dlls that your MyApp.dll or MyApp.exe is dynamically linked to.
I think that is right, maybe someone else can confirm this as well.
The libraries did create a .pdb at the moment of building them. And since the linker does combine multiple pdb at the moment of making an executable (from the original multiple pdb) I thought perhaps there was a way to tell it to do so.
Regardless, what I finally end up doing was to compile the libraries with /Z7 instead of /Zi.
That meant that the obj files hold the debug information instead of a separate .pdb. The libraries are a lot bigger as a result and, since the format is older, I do not know what debug information is lost in the change. I also read that /Z7 interferes with incremental linking. Far from perfect. But at least the resulting library is self contained, no need for pdb.