Product Changes: Visual C++ .NET 2003

Note

Some features mentioned in this topic may not still exist in the current version of Visual C++. For more information, see Changes in Visual C++ 2005 and Earlier Editions.

Microsoft Visual C++ .NET 2003 provides many improvements and several new features:

  • Visual C++ Compiler, Language, and Linker

  • Visual C++ Libraries

  • Development Environment

  • Windows Forms Designer for Managed Extensions for C++

  • Project Build Automation Model

Visual C++ Compiler, Language, and Linker

The following compiler, linker, other build tools, and Visual C++ language features are new for Visual C++ .NET 2003.

Compiler

  • Information on how to run a Managed Extensions for C++ application built with the current version's compiler on a previous version of the runtime.

  • A walkthrough has been added showing how to port an existing, native application to use Managed Extensions for C++: Walkthrough: Porting an Existing Native C++ Application to Interoperate with .NET Framework Components

  • You can now create a delegate on a method of a value type.

  • The compiler's conformance with the C++ standard has been significantly enhanced for Visual C++ .NET 2003.

  • /arch compiler option is added.

  • /Gf is deprecated and will be removed in the next version of Visual C++.

  • /G7 compiler option is added.

  • The /GS compiler option has been enhanced to help protect local variables from direct buffer overruns.

  • The /noBool compiler option has been removed. The compiler now allows bool to appear only as a keyword (and not an identifier) in a Visual C++ source code file.

  • The long long type is now available as a typedef of __int64. Note that there is not yet support for long long in the CRT.

  • The /Zm compiler option now specifies the precompiled header memory allocation limit.

  • _InterlockedCompareExchange intrinsic now documented.

  • _InterlockedDecrement intrinsic now documented.

  • _InterlockedExchange intrinsic now documented.

  • _InterlockedExchangeAdd intrinsic now documented.

  • _InterlockedIncrement intrinsic now documented.

  • _ReadWriteBarrier intrinsic added.

Visual C++ Attributes

  • implements attribute is now documented.

Linker

The following linker options have been added:

  • /ASSEMBLYDEBUG

  • /ASSEMBLYLINKRESOURCE

  • /DELAYSIGN

  • /KEYFILE

  • /KEYCONTAINER

  • /SAFESEH

Preprocessor

  • The _STATIC_CPPLIB symbol is now documented for use with /MD.

  • The _CPPLIB_VER symbol is now documented.

  • The #import directive now has the following attributes documented:

    • auto_search

    • auto_rename

    • no_search_namespace

    • rename_search_namespace

    • tlbid

MASM

The .SAFESEH directive and /safeseh ml.exe option were added.

Visual C++ Libraries

Old iostream Library

The old iostream library has been removed from Visual C++ in this release. Use the Standard C++ Library for iostream programming.

C Run-Time Library

  • The documentation for the C Run-Time Library now includes information for .NET Framework equivalents.

  • _get_heap_handle has been added.

  • The _CRTDBG_CHECK_DEFAULT_DF macro, used in _CrtSetDbgFlag is now defined to zero, meaning that no heap checking is done by default.

  • swprintf now is compatible with the ISO C standard (C++ only).

  • vswprintf now has a C++-only form that lets you specify the maximum number of characters to store.

  • For several of the multibyte functions, such as _mbsset, the CRT was not always detecting invalid multibyte strings, where a lead byte would be followed by a null trail byte. The CRT now has more checks for invalid multibyte characters, where a lead byte is followed by a null trail byte.

  • _set_purecall_handler has been added.

  • Previously, when a process loaded a DLL that statically referenced the CRT library, floating-point precision would be initialized to 53 bits. In Visual C++ .NET 2003, floating-point precision is not initialized in this scenario. This may cause a breaking change in some existing applications that relied on the CRT to initialize floating-point precision.

  • The CRT now has float and double forms for all math functions. These new functions are only callable from Visual C++.

Standard C++ Library

In previous releases, input and output of characters to a stream may have resulted in character or unsigned short values being stored if wchar_t was not defined as a native type. Now, an unsigned short is always treated as a character.

In Visual C++ .NET 2003, members of the <hash_map> and <hash_set> header files are no longer in the std namespace, but rather have been moved into the stdext namespace.

The Standard C++ Library has been updated to take advantage of the enhanced Visual C++ compiler support for the C++ standard. For example, the Standard C++ Library implementation shipping in Visual C++ now makes use of partial template specialization.

ATL

  • In Visual Studio .NET 2003, the MIDL compiler has a default setting of /robust, which causes projects running under Windows NT 4 to stop responding.

To change the MIDL compiler flag to /no_robust

  1. Right-click your project, and on the shortcut menu, click Properties.

    The Project Properties dialog box appears.

  2. In the left pane, click MIDL, and then select Command Line.

  3. Enter /no_robust in the Additional Options text box.

  • The ATL string conversion macro USES_CONVERSION has been superseded by USES_CONVERSION_EX. It will try to allocate space on the stack. If there is no available room on the stack, it will try the heap. If there is no room on the heap, it will return NULL. USES_CONVERSION_EX has an extra parameter (threshold) that you can use: if the request is larger than the size of threshold, the macro will go to the heap directly.

  • _alloca has been superseded by _atl_safe_alloca.

  • The class CSocketAddr Class has been added to provide protocol independent methods for dealing with both IPv6 and IPv4 addresses.

  • When building a project that outputs an executable, ATL automatically adds quotation marks around the path name created at run time with the %MODULE% registrar script parameter. If you do not want the path name to include the quotation marks, use the new %MODULE_RAW% parameter instead.

    When building a project that outputs a DLL, ATL will not add quotation marks to the path name if %MODULE% or %MODULE_RAW% is used.

MFC

  • Connection maps are no longer compacted when a connection point is deleted; instead, the deleted connection point is replaced with a NULL. Therefore, you should check for NULL when using CConnectionPoint::GetConnections or CConnectionPoint::GetNextConnection.

  • The following functions may now throw exceptions: CSimpleString::FreeExtra, CSimpleString::GetAt, CSimpleString::operator [], CSimpleString::ReleaseBuffer, CSimpleString::ReleaseBufferSetLength, CStrBuf::SetLength, and some CTime::CTime constructors.

  • The behaviors of AfxIsValidAddress and AfxIsValidString have changed. In non-debug builds, both functions just test for a non-NULL argument.

  • CHeaderCtrl::GetOrderArray no longer has a default second parameter; -1 is no longer a valid value for the second parameter.

  • CAsyncSocket has new IPv6-aware members: GetPeerNameEx, GetSockNameEx, ReceiveFromEx, and SendToEx.

ATL and MFC

  • The CImage class now keeps track of the number of objects created. Whenever the count goes to 0, the function GdiplusShutdown is automatically called to release resources used by GDI+. This prevents resources from not being freed when CImage objects are created by a DLL.

  • The MFC CString class has been rewritten as a template class, CStringT. This allows you to use CString in ATL projects without linking in the larger MFC static library or DLL.

    Note

    This release fixes the problem described in the Knowledge Base article, "PRB: Linking Errors When You Import CString-Derived Classes" (Q309801). You can find Knowledge Base articles on the MSDN Library CD-ROM or at https://support.microsoft.com/default.aspx. If you encountered linker errors when exporting a CString-derived class from an MFC extension DLL in Visual C++ .NET 2002 and have applied the workaround described in this article, you should remove the workaround code, because the problem has been fixed in Visual C++ .NET 2003.

  • CStrBufT and CSimpleStringT now have an additional template parameter that tells you whether CString is to be used from the MFC DLL. Use the typedef found in the CStringT or CSimpleStringT class in atlsimplstr.h (rather than the global typedef).

ATL Server

  • In an XML Web service created with ATL Server, the default action is to validate SOAP parameters after they are read. To switch off the validation, define the macro _ATL_SOAP_NO_PARAMETER_VALIDATIONS.

  • SPROXY.EXE can now process a .discomap file or a .wsdl file. Specify the new /wsdl option when you use a .wsdl file as the input:

    sproxy /wsdl <input_location>
    

    where <input_location> is the path of the .wsdl file to use.

    SPROXY.EXE can now process a results.discomap file:

    sproxy results.discomap
    

    Note that the .discomap file contains a link to a local copy of the .wsdl file and also uses a local copy of the schema file.

Development Environment

Note

Some features mentioned in this topic may not still exist in the current version of Visual C++. For more information, see Changes in Visual C++ 2005 and Earlier Editions.

When you open a Visual C++ project from Visual Studio .NET in Visual C++ .NET 2003, the old project file will be renamed and a new project file for the Visual C++ .NET 2003 environment will be created.

The format of a .vcproj file is now documented.

The following new features are in the development environment:

  • $(WebDeployPath), $(WebDeployRoot), $(ParentName), $(RootNameSpace), $(SafeParentName), and $(SafeInputName) macros have been added.

  • It is now possible to build a project without building any of the projects dependent projects.

Managed Extensions for C++ Project Templates

This release includes several new project templates that you can use to create applications in Managed Extensions for C++:

  • Windows Controls Library (.NET)

  • Windows Forms Application (.NET)

  • Windows Service (.NET)

In addition, the templates for managed projects in Visual C++ .NET 2002, were renamed for this release:

  • Managed C++ Application is now called Console Application (.NET)

  • Managed C++ Class Library is now called Class Library (.NET)

  • Managed C++ Empty Project is now called Empty Project (.NET)

  • Managed C++ Web Service is now called ASP.NET Web Service

Windows Forms Designer for Managed Extensions for C++

With the addition of the Windows Forms Designer for this release, Visual C++ introduces a rapid application development solution for creating your Windows Forms applications in Managed Extensions for C++.

This feature includes full support of the Toolbox and Server Explorer, which allows you to drag and drop, or cut and paste, controls and components directly onto your Windows Forms application. In addition, you can easily manipulate the properties of your controls and components through the Property Grid.

Project Build Automation Model

Visual C++ .NET offers new property pages and a number of new objects, as well as new properties and methods for existing objects that enhance the project build model.

New Property Pages

Managed Resources Property Page

XML Data Generator Tool Property Page

Managed Wrapper Property Page

Auxiliary Managed Wrapper Property Page

New Objects

VCALinkTool Object

VCActiveXReference Object

VCAssemblyReference Object

VCAuxiliaryManagedWrapperGeneratorTool Object

VCManagedResourceCompilerTool Object

VCManagedWrapperGeneratorTool Object

VCPrimaryInteropTool Object

VCProjectReference Object

VCReference Object

VCReferences Collection

VCReferenceConfiguration Object

VCXMLDataGeneratorTool Object

New or Changed Members for Existing Objects

Several new or updated properties and methods were added to existing objects. Note that changes can encompass several things, such as an updated signature or the addition of new members.

Object

New or changed member

VCCLCompilerTool Object

EnableEnhancedInstructionSet Property

 

ToolKind Property

VCLinkerTool Object

FixedBaseAddress Property

 

ToolKind Property

VCLibrarianTool Object

ToolKind Property

VCCustomBuildTool Object

ToolKind Property

VCMidlTool Object

ToolKind Property

VCResourceCompilerTool Object

ToolKind Property

VCPreBuildEventTool Object

ToolKind Property

VCPreLinkEventTool Object

ToolKind Property

VCPostBuildEventTool Object

ToolKind Property

VCBscMakeTool Object

ToolKind Property

VCNMakeTool Object

ToolKind Property

VCWebServiceProxyGeneratorTool Object

Namespace Property (VCProjectEngine)

 

References Property

 

ToolKind Property

VCWebDeploymentTool Object

ToolKind Property

VCProject Object

AddAssemblyReference Method

 

AddActiveXReference Method

 

AddProjectReference Method

 

CanAddAssemblyReference Method

 

CanAddActiveXReference Method

 

CanAddProjectReference Method

 

Object Property

 

References Property

 

ReferencesConsumableByDesigners Property

 

RemoveReference Method

 

RootNamespace Property

 

VCReferences Property

VCFile Object

AddFile Method

 

CanAddFile Method

 

FileType Property

 

Items Property

 

Object Property

 

RemoveFile Method

VCFilter Object

Object Property

VCConfiguration Object

FullReferencesPath Property

 

ReferencesPath Property

 

ReferenceTools Property

 

SatelliteDLLs Property

 

StopBuild Method

 

StyleSheets Property

VCStyleSheet Object

FullReferencesPath Property

 

ReferencesPath Property

 

ReferenceTools Property

 

StyleSheetDirectory Property

 

StyleSheetName Property

VCFileConfiguration Object

ProjectConfiguration Property

 

Compile Method

 

OutputUpToDate Property

VCProjectEngine Object

ShowEnvironmentInBuildLog Property

See Also

Other Resources

Product Changes in Visual C++ Releases