Catálogo de publicaciones - libros
Expert C++/CLI: .NET for Visual C++ Programmers
Marcus Heege
Resumen/Descripción – provisto por la editorial
No disponible.
Palabras clave – provistas por la editorial
Software Engineering/Programming and Operating Systems
Disponibilidad
Institución detectada | Año de publicación | Navegá | Descargá | Solicitá |
---|---|---|---|---|
No detectada | 2007 | SpringerLink |
Información
Tipo de recurso:
libros
ISBN impreso
978-1-59059-756-9
ISBN electrónico
978-1-4302-0357-5
Editor responsable
Springer Nature
País de edición
Reino Unido
Fecha de publicación
2007
Información sobre derechos de publicación
© Apress 2007
Cobertura temática
Tabla de contenidos
Why C++/CLI?
Marcus Heege
The road to C++/CLI began some 30 years ago with a very small C program: // HelloWorld.cpp // compile with “CL HelloWorld.cpp” #include <stdio.h> int main() { printf(“hello, world”); }
Pp. 1-10
Managed Types, Instances, and Memory
Marcus Heege
.NET’s CLI introduces a new type system called the Common Type System (CTS). A major design goal of the CTS is language interoperability. This means that the CTS is used by all .NET languages—hence the name Type System. Language interoperability is helpful for users of class libraries as well as for developers writing class libraries for others. Due to the CTS’s language interoperability, many .NET class libraries can be used by all .NET languages. Even if you switch from one .NET language to another, your knowledge about the .NET class libraries and their types is likely not lost. This is especially helpful because the Microsoft .NET Framework SDK ships with a huge, powerful base class library. Throughout this book, I will call this base class library the Framework Class Library (FCL).
Pp. 11-29
Writing Simple .NET Applications
Marcus Heege
This chapter covers basics that you need to know to understand explanations in later chapters. I will familiarize you with a few fundamental types from the FCL that are used in different contexts throughout this book. Through the discussion of small applications that act as clients of the FCL, this chapter also explains how C++/CLI language concepts for common tasks like using libraries, using namespaces, exception handling, and casting can be used in the managed world, and how these concepts differ from their native counterparts.
Pp. 31-47
Assemblies, Metadata, and Runtime Services
Marcus Heege
Assemblies are a fundamental abstraction of the .NET infrastructure. Developing software based on .NET always implies working with assemblies. To use managed types defined outside of your project, you have to reference the assembly that defines the required types. The target of a build process is an assembly, too. In this chapter, you will learn how assemblies can be uniquely identified and how the runtime searches for an assembly.
Pp. 49-71
Defining Managed Types
Marcus Heege
Aprimary task of every .NET programming language is to map source files to assemblies with custom managed type definitions. This chapter discusses the C++/CLI language features to define custom managed types.
Pp. 73-116
Special Member Functions and Resource Management
Marcus Heege
The previous chapter discussed how to implement different kinds of managed types and relationships between types. In this chapter, I will focus on the implementation of special member functions for custom managed types. Like in the C++ type system, these special member functions are used to integrate a type’s behavior into language and runtime constructs. As an example, constructors and destructors allow you to integrate your type in the object creation and destruction infrastructure.
Pp. 117-142
Using C++/CLI to Extend Visual C++ Projects with Managed Code
Marcus Heege
One of the most important use cases for C++/CLI is the extension of existing projects with managed features. Even if you do not plan to rewrite your complete project purely with managed code, chances are good that your application will need to call managed libraries like the .NET Framework 3.0 APIs—Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF), Windows Workflow Foundation (WF), and Windows CardSpace (WCS). The interoperability features of C++/CLI can provide a perfect solution to this requirement, because you can mix managed and native code into a single assembly, and you can define precisely when a transition from managed code to unmanaged code and vice versa is done.
Pp. 143-171
Mixing the Managed and the Native Type System
Marcus Heege
Using the step-by-step approach explained in Chapter 7, you can inject managed code parts into a C++ project. Due to the source code compatibility, you can easily call from native code to managed code by just declaring the functions you want to call. However, in the samples discussed so far, the managed functions called from native code and the native functions called from managed code have had void as a return type, and no arguments. For nontrivial scenarios, functions with less simplistic signatures are obviously needed.
Pp. 173-201
Managed-Unmanaged Transitions
Marcus Heege
In Chapter 1, I explained that calling functions across interoperability boundaries can be as easy as calling native functions from native code. Normal method declarations are sufficient for both directions of interoperability. You can simply rely on the C++/CLI compiler to handle all kinds of method calls with any kind of native arguments in the right way. These method calls include the following scenarios:
Pp. 203-232
Wrapping Native Libraries
Marcus Heege
The last two chapters covered details about C++/CLI interoperability. These features are not only useful for extending existing projects with features from managed libraries (which was discussed in Chapter 7), but they can also be useful if you want to give a native library a managed face so that it can be used by other .NET languages.
Pp. 233-251