load/unload C dll with C# problems
Posted
by Goran
on Stack Overflow
See other posts from Stack Overflow
or by Goran
Published on 2010-04-12T18:36:39Z
Indexed on
2010/04/12
18:43 UTC
Read the original article
Hit count: 400
I'm having problems with external native DLL.
I'm working on ASP.NET 1.1 web application and have this DLL which I load through DLLImport directives.
This is how I map DLL functions:
[DllImport("somedllname", CallingConvention=CallingConvention.StdCall)]
public static extern int function1(string lpFileName,string lpOwnerPw,string lpUserPw);
[DllImport("somedllname", CallingConvention=CallingConvention.StdCall)]
public static extern int function2(int nHandle);
I call the dll methods and all works great, but I have problems with this DLL crashing my web site on some cases, so I would like an option to unload the dll after I use it.
I found a solution at this link, but I don't have 'UnmanagedFunctionPointer' attribute in .NET 1.1 available.
Is there a way I can achieve what this guy did with his example?
© Stack Overflow or respective owner