Managed C++ and the Side-by-Side Cache
by Richard Grimes

Listing One

using namespace System;
public ref class Test
{
public:
   void CallMe()
   {
      Console::WriteLine("called me");
   }
};

Listing Two

using System;

class App
{
   static void Main()
   {
      Test test = new Test();
      test.CallMe();
   }
}

Listing Three

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' 
         version='8.0.50608.0' processorArchitecture='x86'
          publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
</assembly>

Listing Four
# The main target
all: app.exe

# A C# process that depends upon a Managed C++ library
app.exe : app.cs lib.dll
   csc app.cs /r:lib.dll
# This is the second invocation of the linker, so the object file and 
# manifest will already exist, so they do not need to be rebuilt.
lib.dll : lib.cpp lib.res lib.obj
   link /DLL /manifest:no /machine:x86 lib.res lib.obj
lib.res : lib.rc
   rc lib.rc
# Create a temporary resource script that binds the manifest file to the DLL
lib.rc : lib.dll.manifest
   type <<$@
#include <winuser.h>
2 RT_MANIFEST lib.dll.manifest
<< KEEP
# Create the object file, and invoke the linker to create the manifest file
lib.dll.manifest lib.obj : lib.cpp
   cl /LD /clr lib.cpp

Listing Five

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (r) 1981-2001 Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

    <assemblyIdentity type="win32-policy" name="policy.8.0.Microsoft.VC80.CRT" 
      version="8.0.50727.42" processorArchitecture="x86"
      publicKeyToken="1fc8b3b9a1e18e3b"/>
    <dependency>
        <dependentAssembly>
            <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" 
               processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"/>
            <bindingRedirect oldVersion="8.0.41204.256-8.0.50608.0" 
               newVersion="8.0.50727.42"/>
        </dependentAssembly>
    </dependency>
</assembly>




5


