.net Language Interoperability
-
Hi, I am working on a web application in ASP.net & C# .For one of the utilities on my site, i need to use an available VC++ project. This VC++ project produces an exe as its output. I tried changing the output type of the VC++ project to .dll, but it doesn't help and after this, the project itself stops working. Can someone please tell me as to how to use this VC++ project into my web application? Thanks.
-
Hi, I am working on a web application in ASP.net & C# .For one of the utilities on my site, i need to use an available VC++ project. This VC++ project produces an exe as its output. I tried changing the output type of the VC++ project to .dll, but it doesn't help and after this, the project itself stops working. Can someone please tell me as to how to use this VC++ project into my web application? Thanks.
There're some very big issues involved here. If your VC++ project produces an exe, it is either a Windows or Console application project. So look bellow. This would work with VS2008, I don't remember how to do it using older versions. 1.- [Easiest] Is the VC++ project a managed project? Go to project properties and take a look under "Common Properties", if this tab works. Allows you to change "Targeted Framework", add references or so. It is a managed project. Solution: Just changed your project output type: Go to "Configuration Properties" > "General" > "Configuration Type" and change it to "Dynamic Library (.dll)". And just try placing the reference in your web.config, it should work. Down side. Global funcions and not managed types are not going to work for you ASP.NET site. All types you'd like to use must be marked as "__gc" or "__value". Take a look to this MSDN link > ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/dv_vclang/html/63b1e7ab-d1c8-4582-aa89-21bfddf694a9.htm 2.- [Hardest] Your project is a native one. Solution: First, change the project type, same as above (not mandatory, exe also can export functions). You'll have to make sure you're exporting the funcions you'd like to use from managed code. To see exported functions use "dumpbin.exe /EXPORTS " from VS command prompt. Then you'll have to create a "wrapper" managed library to access to unmanaged, see this one to use native functions from managed code > ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/fxref_mscorlib/html/36830e35-7f2e-b1fa-87ca-144346051059.htm . Down side, most web hostings won't allow you to access to native code, or at lest no more than .NET native libraries or Windows API. Hope it'll help