Game Development Reference
C++/CLI do not need to use P/Invoke and can include the appropriate header files
and call the unmanaged routines directly. This feature is called “It Just Works,” or
IJW, and both P/Invoke and IJW use the same underlying mechanism so it is bene-
ficial to understand that mechanism.
C++/CLI can also be used to wrap a C++ class or a COM object. Wrapping a COM
object can provide better performance than using the COM interface and a Runtime
Callable Wrapper because of reduced interoperability overhead, commonly referred
to as “thunking.” It also allows for closer control of how members are wrapped.
For some COM objects, it may not be possible to use the Type Library Importer
utility (tlbimp.exe) to generate an RCW for the COM object, and C++/CLI provides
a solution to this problem.
There are quite a number of benefits when the .NET platform is used for game
engine tools development. Probably the largest benefit is the massive amount of
productivity gain. Building applications in Microsoft.NET is much faster than any
other RAD environment, because of the excellent IDEs available, as well as a very
robust core framework that all managed applications can take advantage of. You
can have a functional UI for simple tools created in under a couple of minutes,
spending less time on UI and more time on functionality and usability. Being able
to build a functional UI so quickly is very beneficial to a number of projects, most
notably “throw-away” or “skunk works” tools that need a quick and dirty user inter-
face, with the majority of the development time spent on building functionality.
Microsoft.NET also offers ease of deployment, solving the “DLL hell” agony.
Through a built-in versioning mechanism available to all .NET assemblies, specific
versions of a library can be targeted.
Other benefits are the promotion of scaleable architectures and the ability to choose
architectures that are robust, reliable, and secure. Scaleable architectures promote
reusability and strong design.
The interoperability support for legacy applications and components allows for
easier migration from an existing code base to the .NET platform. A number of
methods for bridging communication between managed and unmanaged applica-
tions exist, and these methods are covered in much greater detail later in the topic.
Robustness is provided through type-safety and garbage collection. The compiler
catches all invalid conversion operations and throws the appropriate exception. A