title: Using c++ dll as an assembly in SQL Server
body: <p>I know I can register a .NET dll as an assembly and call a function within my sql query. But I'm getting confusing statements as to using a c++ or c++/cli dll for the same purpose.</p>
  
  <p>The link below describes a way to just do that:</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/vstudio/hc912f03(v=vs.120).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/vstudio/hc912f03(v=vs.120).aspx</a></p>
  
  <p>but then I'm getting the following error message:</p>
  
  <p>CREATE ASSEMBLY for assembly 'libname' failed because assembly 'libname' is malformed or not a pure .NET assembly. Unverifiable PE Header/native stub.</p>
  
  <p>Another document actually states that only pure .NET modules can be used.</p>
  
  <p><a href="http://blogs.msdn.com/b/psssql/archive/2013/02/23/unable-to-register-net-framework-assembly-not-in-the-supported-list.aspx" rel="nofollow">http://blogs.msdn.com/b/psssql/archive/2013/02/23/unable-to-register-net-framework-assembly-not-in-the-supported-list.aspx</a></p>
  
  <p>So I'm wondering what is true and if possible how to use a c++ dll with SQL Server 2012?</p>
  
  <p>I have tried to wrap my c++ dll with a c++/cli wrapper compiled with /clr:safe but to no success.</p>