|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how to use VC++ dll in .netI am having one VC++ dll. I need to refer this dll form C# web site. When I try to add the dll as reference it says the "dll should be com dll or assembly". So I understood I shouldnt use the VC++ dll as it is. I created a serviced component so called wrapper class. Then I tried to add this wrapper dll to my .net web site. My wrapper looks like The project is built. when i run the application at the line of calling VC++ function thro' wrapper class it throws an exception as [DllImport("a.dll", EntryPoint = "fun1")] public static extern int fun1(int p1, int p2, int p3, int p4, ref string p5); a.dll->VC++ dll fun1-> function name The matching function in VC++ looks like short CNK::fun1(ULONG p1,ULONG p2,ULONG p3,ULONG p4,WCHAR* p5) Is the parameter data type matching with vc++ and .net is correct? "Attempted to read or write protected memory. This is often an indication that other memory is corrupt". Am I anyway wrong here. Kindly help me. Tx in advance >[DllImport("a.dll", EntryPoint = "fun1")] Try it with> public static extern int fun1(int p1, int p2, int p3, int p4, ref >string p5); [DllImport("a.dll", EntryPoint = "fun1", CharSet=CharSet.Unicode)] public static extern short fun1(..., string p5); Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. |
|||||||||||||||||||||||