why visual studio 2010 generated dll size larger? - visual-studio-2010

I have a dll project that was created in VC++ 2008. The released dll file after building this project in VS 2008 is 299kB.
But, when I convert the project to VC++ 2010, the size of the output dll grows significantly!!! (1643kB !!!)
Why is the output dll file generated by Visual Studio 2010 so much larger?
Are there any settings in Visual Studio 2010 which I could edit, to get a smaller output file released?

The /MT flag means you're statically linking in the C runtime library.
Presumably, in your previous project in VS 2008, you were dynamically linking to the runtime library, which will make the output file smaller because it doesn't have to embed all of the required functionality from the C runtime library in your DLL.
The fix is simple, just change the setting to /MD. Dynamic linking is much preferred anyway.

Related

Use the 64-bit Visual C++ Toolset in Visual Studio 2017

My (quite large) C++ project has grown to a point where I get a C1060: compiler is out of heap space error when trying to compile my project.
I'm compiling on a 64-bit Windows 10 machine, but it seems that Visual Studio is compiling my project with the 32-bit toolset (see screenshot below).
The C1060 help page asks me to use the 64-bit toolset, but the link provided talks about how to enable it when compiling with the command line only.
Is there any way to set project properties or something else in Visual Studio 2017 to tell it to use the 64-bit compiler toolset (which is already installed on my machine)?
This is how I made Visual Studio 2017 use the x64 toolset, as per this answer:
Open the .vcxproj file with your favourite text editor, find this line:
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Then add this immediately after it:
<PropertyGroup>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>
That answer was for Visual Studio 2013 but it works for 2017 too.
Additional Note: However, it turns out this didn't actually solve my problem. The 64-bit toolset ate up all the memory on my machine and forced me to need to reboot. When I rolled back the latest changes to the code, it compiles using ~2.8GB for the 32-bit compiler, and compiles using ~4.2GB for the 64-bit compiler (the latest code consumed ~6.4GB before freezing my task manager on my 8GB machine). I'll be looking through the new code and attempting to figure out why so much more memory was needed.

how can i use visual studio 2008 created dll in visual studio 2010?

Get me details which is dynamic link library version used in which are operating
is it possible, i have created dll in visual studio 2008 and i used this dll in visual studio 2010.
and vice versa also
If this is a Standard DLL and if you just Exchange plain pointer and PODs and don't use any CRT objects accross the modules you can use any DLL of any Visual Studio Version up and down.
If you try to Exchange std::string objects or elements form the STL, or you try to allocate Memory in the DLL and free it in the EXE you run into troubles. Or if you export classes (not plain interfaces), you may get problems too.
For example. If you create a Standard DLL with the application wizard in VS you get a DLL that is usable from any other module created with any other VS... this will work always.
Again: It just depends on the interface of your functions you are using.

How can i package the Visual Studio 2010 runtime with my .exe and .dll file?

As sort of a hello world attempt, I am compiling a simple EXE that dynamically loads a DLL (which I have also written) using only C++ files, building with Visual Studio 2010. However, when running on a new machine, an error appears that the VS2010 runtime is not present.
Is there a way to package the runtime in my application or DLL so this doesn't occur? Without using an installer program.
Alternatively, is there a way to exclude requiring the runtime at all?
(I am using Visual Studio 2010, but this could really be of interest for all versions)

Debugging VB6 Code From Visual Studio 2010

I have .NET 3.5 web application which uses some COM dll created in VB6.
I have source code for both. Also I have pdb file for the COM dll.
I would like to load the VB6 dll code inside Visual Studio 2010 for debugging.
I am able to step into dll code from VS If I loaded the COM app in VB6 IDE.
Since I am new to VB, debugging using VB6 IDE is bit tedious for me.
So I wanted to debug the COM app code inside Visual Studio 2010.
I followed the instructions in Robgruen's Blog
The problem is VS2010 automatically creating Interop dll for the corresponding COM dll,
and It uses the Interop dll only. While debugging when I try to manually load the Symbol file for the COM dll(let's say MyComApp.dll) It fails and VS is instructing me to load Interop.MyComApp.pdb file. But I have MyComApp.pdb only.
How do I make this work?
You can not debug VB6 code in Visual Studio 2010 at any level higher than the compiled assembly code.
You can however convert your VB6 dll project to VB 2010 then use it in Visual Studio 2010.
Just drag and drop your VB6 project to Visual Studio 2010 (drag project to icon of VS 2010 then drop) and upgrade wizard will automatically convert it.
Or just use Artinsoft programs.
Good Luck! :)

Recompiling a library from VS 2008 to VS 2010

I open up the VS 2008 solution of the library in VS 2010 and it automatically converts it. Then I build under Debug DLL, Release DLL. But this only gives me the .dll files and incremental linker files (.ilk). How do I get the corresponding .lib files for the .dll's?
They should be under the intermediate directory. Check project properties (Configuration Properties -> General) to see where it is

Resources