0

according to my another question , suppose that I have a .lib files and I don't know which .lib a specific function belongs to?

Somewhere I studied if I link all of that .libs this will not effect the size of my final project?
Because VC won't install .libs that are not used in the final?
Is it true?
Can you explain me the mechanism that VS uses to link libraries?


Edited section of my question based on @HansPassants comment. How can I see the contents of a .lib file using Dumpbin.exe

I have searched my Visual studio's install folder and found the file:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\dumpbin.exe  

But when I double-click on it, I get the error:

enter image description here

Could you learn me how to use dumpbin.exe. e.g. how to introduce a .lib file to this .exe and then extract the contents of it?


Edited section of my question based on @Roger Rowland's comment

I runned dumpbin.exe from Microsoft Visual Studio 2010 command prompt and this is what I have reached for the agg.lib. How can I explore the contents of the .lib. I mean how can I understand a specific method is written in this .lib or in another?
How can I understand which .lib should I link in order not to get error when running a specific method?

enter image description here


Please learn me how to export contents of a .lib
This is what I have done already. The commands that I have entered are:

C:\Program Files(x86)\Microsoft Visual Studio 10.0\VC\> D:\JobList\Lib\GDAL_lib\x86\lib\agg.lib\EXPORTS  
C:\Program Files(x86)\Microsoft Visual Studio 10.0\VC\> D:\JobList\Lib\GDAL_lib\x86\lib\agg.lib/EXPORTS  

enter image description here


The screenshot of what I have tried up to now:
enter image description here

Community
  • 1
  • 1
Sepideh Abadpour
  • 2,550
  • 10
  • 52
  • 88
  • 1
    You could just look at it contents with Dumpbin.exe. And of course the owner of the library will know, just ask. But yes, link the whole kit-and-caboodle and the linker will only pick what it needs. – Hans Passant Sep 08 '13 at 18:34
  • @HansPassant as you said I can't ask the owner of the library for every function that I use so I have 2 ways to solve the problem **1-** link the whole kit and the linker will just pick up what it needs when it comes to make an installer program **2-** look at my .lib contents with dumpbin.exe but please look at the edited section of my program based on your comment. How can I use dumpbin.exe to explore a .lib file? – Sepideh Abadpour Sep 09 '13 at 05:30
  • 1
    As [MSDN says](http://msdn.microsoft.com/en-us/library/c1h23y6c.aspx) *"You can start this tool only from the Visual Studio command prompt. You cannot start it from a system command prompt or from File Explorer"*. Start the VS Command prompt from the menu and run `dumpbin` from there. – Roger Rowland Sep 09 '13 at 06:57
  • thanks @RogerRowland! I did what you said please look at the edited section of my question based on your comment if you're desired to help me. – Sepideh Abadpour Sep 09 '13 at 08:11
  • 1
    Try `dumpbin agg.lib /EXPORTS` – Roger Rowland Sep 09 '13 at 08:14
  • thanks @RogerRowland I have done what you said but with no result please see the part `Please learn me how to export contents of a .lib` in my question – Sepideh Abadpour Sep 09 '13 at 08:53
  • 1
    You need a space between `agg.lib` and `/EXPORTS` – Roger Rowland Sep 09 '13 at 08:56
  • @RogerRowland tried but the same results as the second picture in my question. As the last question I ask: Is it very problematic if I link all the .libs that I have for the library? Will the linker link only the .libs that it needs when it comes to make an installer for my program? – Sepideh Abadpour Sep 09 '13 at 09:10
  • 1
    The linker will only link what it needs - there will be no redundant code in the resulting exe. Also your screenshot doesn't show a space before `/EXPORTS`, that's why it's failing. – Roger Rowland Sep 09 '13 at 09:11
  • @RogerRowland you can see the screenshot of what I have tried the last time. I've marked the place you mean with a red pen. you see that it does have a space. tell me if I'm doing something wrong or what do you do in such situations? – Sepideh Abadpour Sep 09 '13 at 09:21

0 Answers0