I am trying to use a legacy C++ dll that has around 5 C/C++ dependencies in SharePoint. I created a wrapper for the dll and it works fine in a test desktop program. I added the wrapper and all C++ libraries to the event receiver assembly and they are being deployed to the WebApplication target. When I run the receiver I get
SecurityException was unhandled by user code System.Security.Permission.SecurityPermission
when it hits the C++ method.
Next, I tried using SPSecurity.RunWithElevatedPrivileges() in the wrapper but I get
SecurityException was unhandled by user code Microsoft.SharePoint.Security.SharePointPermission`.
How can I get the C++ library to work?

SPSecurity.RunWithElevatedPrivileges()– Dave Wise Feb 21 at 19:30