Sign in to follow this  

VS 2010 is generating .lib and .exp files for a normal project, why?

This topic is 1854 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I never paid much attention to this, so I dont know if it started all of suddem or if it was doing that since the begining...but I dont know why those are being generated.

Searching google a bit looks like its because my project have stuff with __declspec(dllexport), but I didnt wrote any of those, nor I can find any of those using vs find entire solution..

Im afraid my project config files may be glitched or my compilation times can be greater than theyd need to be due the generation of those annoying files..

The only external stuff Im using on my project is boost, and Im using the boost serialization stuff, witch requires a lib linkage..perhaps is boost the guilt one? anything should I do or care about?

Share this post


Link to post
Share on other sites
I would imagine Boost does some stuff, and it's also very likely the Microsoft CRT does some futzing too, especially if you use the run-time-linked libraries.


With that said this will have very, very negiligible impact on final compile time and you're making a mountain out of a molehill. Sometimes things need to be exported for stuff to Just Work and VIsual Studio is mature enough that basic kinks like this would have been worked out. :)

Share this post


Link to post
Share on other sites
If you add
dumpbin /exports $(TargetPath)
as a post-build event for the dll/exe project generating the lib & exp, the build output will tell you what functions are being exported.

I know VS 2008 has a bug where certain build options will cause the project to export std::_Init_locks which in turn will generate an exp & lib for otherwise non-exporting projects. I don't know if they fixed it though.

Share this post


Link to post
Share on other sites
[quote name='adeyblue' timestamp='1353084678' post='5001572']
If you add
dumpbin /exports $(TargetPath)
as a post-build event for the dll/exe project generating the lib & exp, the build output will tell you what functions are being exported.

I know VS 2008 has a bug where certain build options will cause the project to export std::_Init_locks which in turn will generate an exp & lib for otherwise non-exporting projects. I don't know if they fixed it though.
[/quote]

Im getting this:

Dump of file C:\Users\Gateway\Documents\Visual
1>LINK : fatal error LNK1181: cannot open input file 'C:\Users\Gateway\Documents\Visual'
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "dumpbin /exports C:\Users\Gateway\Documents\Visual Studio 2010\Projects\Astar\Debug\Astar.exe
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 1181.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

"Dump of file C:\Users\Gateway\Documents\Visual" -> from where this come from? theres no such thing, off course it will not open
i just copy and pasted the line from your post on the post build command line, in the project properties

Share this post


Link to post
Share on other sites
You need to put the $(TargetPath) in quotes if it contains spaces to ensure that the spaces are parsed as a single file name and not as argument separators.
[code]
dumpbin /exports "$(TargetPath)"
[/code] Edited by Brother Bob

Share this post


Link to post
Share on other sites
0.00 version
1> 1 ordinal base
1> 132 number of functions
1> 132 number of names

.. 132 lines of weirdo giant strings, looks all of them have "boost" on it

4000 .data
1> 3000 .idata
1> 2B000 .rdata
1> 7000 .reloc
1> 1000 .rsrc
1> B6000 .text
1> 54000 .textbss

normal?
thanks for the help

Share this post


Link to post
Share on other sites
This is totally normal and nothing to worry about.


If you're curious about the cause of this, here's the short-ish technical explanation (may be slightly inaccurate in places, in the interests of making it legible): In Windows, you can dynamically link to not just DLL files but also EXE files. That is to say, you can use functions exported from an EXE from within a loaded DLL, rather than only being able to use DLL functions from within the EXE. (This is actually extremely handy.) When you set up certain configurations of the runtime library (and also some Boost libraries) they are designed to share the implementation between appropriately built DLLs and the base EXE. This means that if you load a DLL that uses the library, and the EXE uses the same version, they can share the library implementation instead of duplicating it.

So basically what you're seeing is a shortcut to allow you to [i]save[/i] compile time and link time. It's a good thing.

Share this post


Link to post
Share on other sites

This topic is 1854 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this