RE: Console App in one EXE file



Good morning, Gerry. Thanks for using Microsoft Newsgroup Service. My name
is Hongye Sun [MSFT] and it is my pleasure to work with you on this issue.

In order to better understand your questions, may I restate your questions
first and then provide my suggestions based on my understanding. If my
understanding is wrong, please let me know.

*Question 1*: Do you mean that you are trying to deploy a simple console
app without needing any additional action of installation or any other
impaction to target machine other than copying application folder.

Answer: One of the answers is, as what you have mentioned, static linking.
However, it is not a recommended one. Dynamic linking is recommended. As
documented at http://msdn.microsoft.com/en-us/library/ms681938(VS.85).aspx.
Dynamic linking has following advantages over static linking:
-Multiple processes that load the same DLL at the same base address share a
single copy of the DLL in physical memory. Doing this saves system memory
and reduces swapping.
-When the functions in a DLL change, the applications that use them do not
need to be recompiled or relinked as long as the function arguments,
calling conventions, and return values do not change. In contrast,
statically linked object code requires that the application be relinked
when the functions change.
... (There is too much of them. Please view details from the link I
provided.)

For your situation, I recommend to use private assembly
(http://msdn.microsoft.com/en-us/library/aa375674(VS.85).aspx). You could
use XCOPY to deploy your application by making Visual C++ library DLLs as
private assemblies. It is well documented at
http://msdn.microsoft.com/en-us/library/ms235291.aspx.
"Steps:
1. Create a folder structure on the development computer that matches the
folder structure to be used on the target computer. For this example,
create a \bin folder and copy myapplication.exe there. Then create a
\bin\mylibrary folder and copy MyLibrary.dll there.

2. On the development computer, from %PROGDIR%\Microsoft Visual Studio
9.0\VC\Redist\x86, copy Microsoft.VC90.CRT and Microsoft.VC90.MFC to \bin
and to \bin\MyLibrary.

3. Copy the \bin folder to the target computer. On a target computer with
manifest-based binding support (Windows XP Home Edition, Windows XP
Professional, Windows Server 2003, Windows Vista) no further preparation is
necessary. On a computer without such support (Windows 98, Windows 98
Second Edition, Windows Millennium Edition, Windows 2000),
Microsoft.VC90.CRT and Microsoft.VC90.MFC must be on the path. "

*Question 2*: What parts of Visual C++ and CRT are installed to Windows by
default?

Answer: Windows are not supposed to install Visual C++ and CRT by default.
It is installed by VCRedist setup or by other software setup like Visual
Studio. There is no official documentation about it.

*Question 3*: Is it also possible to write a single EXE that will run on
x86, x64.

Answer: In x64 windows, it has a 32-bit emulator named: WOW64 to allow
32-bit application to run seamlessly. So you could simply deploy exe to x64
windows just like deploying in x86 windows.

The recommended way is to create two versions of your application target
separately to x86 and x64. That will have the performance benefit for
64-bit application. For you to reference, I provide the way of how to
configure VC++ project to target 64-bit platform. It is detailed documented
at http://msdn.microsoft.com/en-us/library/9yb4317s.aspx. In the link of
second question's answer, it also described how to deploy x64 application
with VC++ library as private assembly by XCOPY.
" For deploying 64-bit applications to 64-bit operating systems, use
\vc\redist\amd64 or \vc\redist\ia64. "

Please feel free to let me know if you have anything unclear. I am more
than happy to be of assistance.

Regards,
Hongye Sun (hongyes@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

.



Relevant Pages

  • RE: old 5.5 servers
    ... Open the local hard drive containing Windows ... Click to open the "ie7" folder and then click to open the spuninst folder ... Microsoft CSS Online Newsgroup Support ... This newsgroup only focuses on SBS technical issues. ...
    (microsoft.public.exchange.admin)
  • RE: Security and EOL issues (was RE: WMF Exploit Patch released)
    ... While I sympathies with those that feel that Microsoft is getting richer ... Compare AIX to Windows, ... software support for AIX Base Operating System 4.3.3. ... Every vendor releases new builds and patches, ...
    (Security-Basics)
  • RE: Stop error message
    ... your Windows Server 2003-based computer ... we cannot help you analyze the dump file in ... Blue Screen Preparation Before Contacting Microsoft ... For a complete list of Microsoft Customer Service and Support phone ...
    (microsoft.public.windowsxp.general)
  • RE: Security and EOL issues (was RE: WMF Exploit Patch released)
    ... Why not set up paid upgrade systems using annual contracts? ... The commitment on the contract is to continue to support as long as contracts are paid with the restriction that the needed support mst be technically feasible and as timely notification as is possible when support is not technically feasible will be provided. ... While I sympathies with those that feel that Microsoft is getting richer ... Compare AIX to Windows, ...
    (Security-Basics)
  • Re: Windows Server 2003 Service Pack 1 will not install
    ... Microsoft CSS Online Newsgroup Support ... Windows Server 2003 Service Pack 1 will not install ... <Update.exe is there in the folder ...
    (microsoft.public.windows.server.sbs)