This is an old revision of the document!


Calling Managed Code (.NET C#) from Unmanaged Code (Any language)
  • Register library.
    • Assembly in GAC:
      C:\>CD C:\MyLibProj\
      C:\>"%WinDir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe" MyLib.dll
      C:\>"%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.0A\Bin\gacinstall.exe" /i MyLib
    • Assembly in application's directory (not in GAC):
      C:\>CD C:\MyLibProj\
      C:\>"%WinDir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe" /CodeBase MyLib.dll
    • Create Type Library from Assembly:
      C:\>CD C:\MyLibProj\
      C:\>"%WinDir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe" MyLib.dll /tlb:MyLib.tlb
  • Create calls (unmanaged code) to library.