Open nickdalt opened 4 years ago
This should be possible today, but I'm not sure if it works out-of-the box with just including the Source Link nuget packages in your projects. You might need some tweaking of the build.
The linker supports embedding source link record in each static lib's PDB and then preservers all these records in the final linked binary. link.exe
has /sourcelink
switch that instructs it to embed specified Source Link JSON.
I test shows few problems:-
Including the NuGet packages in a C++ static lib project does nothing at all. With a exe project it works as expected.
While the linker supports the /sourcelink switch the lib tool does not
lib /sourcelink LINK : warning LNK4044: unrecognized option '/sourcelink'; ignored
So currently the only option would appear to be to create source link files for each lib and then ship them with the libs. They would then need to be combined in the final link (assuming the /sourcelink switch cannot be used multiple times).
Ideally the lib tool would be updated to support /sourcelink
Any news about this @tmat ?
Am also interested in using SourceLink with static libraries
Currently C++ support appears to be limited to DLL and EXE targets.
What I would like to see is sourcelink information being generated for static lib targets and then when the final link occurs into a executable the resulting pdb contains the combined sourcelink information for all the static libs that went into building the executable.
I am not sure if this would require an update to link.exe in order to support this scenario