Chapter 22. Working with Unmanaged Code

After completing this chapter, you will be able to:

  • Explain the issues that affect managed and unmanaged code.

  • Use managed objects in unmanaged code.

  • Use the Platform Invoke mechanism to call unmanaged functions in DLLs.

Although the primary focus of this book is using C++/CLI with the Microsoft .NET Framework, at times you’ll have to call functions outside the .NET environment.

The System::Runtime::InteropServices namespace contains classes and structures to help with interoperation between .NET and the outside world. In this chapter, I’ll introduce one feature of the namespace—the Platform Invoke mechanism for calling unmanaged functions within DLLs. We also investigate some of the other issues that surround ...

Get Microsoft Visual C++/CLI Step by Step now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.