Suggest you see the MSDN, having a lot of example concerning this aspects inside
可以 参考msn 介绍: ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/dv_evtuv/html/etconplatforminvokesupport.htm example: ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/dv_evtuv/html/etconplatforminvokewrapperexample.htm class AlertClass { [DLLImport("ALERT.DLL", EntryPoint="DoAlertRequestThunk"] private static extern int DoRequestThunk(String RequestName, int Count); public static int DoRequest(ref AlertRequst Req) { return DoRequestThunk(Req.RequestName, Req.Count); } }
to billqi(bill): 你所说的是调用动态链接库吧!我现在要调的是lib文件,不是dll文件!
a dll is loaded into your process, so you can call the API directly, but an exe needs to reside in another process, how are you supposed to call a function in another process?
to saucer(思归)老大: 开始搞错了,发贴发成调用exe文件了。现在的问题是我们要将第三方厂商的验证集成到我们的系统中,而他们提供的开发库是一个lib文件(静态的链接库),不知道怎么在asp.net中调用?
DllImport works with LoadLibrary, if they provide 静态的链接库, you canot call it, consider to write a DLL wrapper
to saucer(思归): 老大,怎么在.net下将静态链接库封装到一个DLL中,请给小弟指点一下!
use C++ or whatever language your vendor supports
用中文说就是用VB中转一下,将这个lib变成dll
use visual studio, create a dll project, expose the functions as is, but call the related functions in the statically linked lib
据说可在vc++.net中将静态库编译成动态库就可在c#中用了,可我没用过vc++.net啊,且任务时间又紧,望知道的兄弟们给个步骤。如能有示例就更好了。
参考msn
介绍:
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/dv_evtuv/html/etconplatforminvokesupport.htm
example:
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/dv_evtuv/html/etconplatforminvokewrapperexample.htm
class AlertClass
{
[DLLImport("ALERT.DLL", EntryPoint="DoAlertRequestThunk"]
private static extern int DoRequestThunk(String RequestName, int Count); public static int DoRequest(ref AlertRequst Req)
{
return DoRequestThunk(Req.RequestName, Req.Count);
}
}
你所说的是调用动态链接库吧!我现在要调的是lib文件,不是dll文件!
开始搞错了,发贴发成调用exe文件了。现在的问题是我们要将第三方厂商的验证集成到我们的系统中,而他们提供的开发库是一个lib文件(静态的链接库),不知道怎么在asp.net中调用?
老大,怎么在.net下将静态链接库封装到一个DLL中,请给小弟指点一下!