提供的dll文件中有以下可以调用的函数:
extern "C" DllExport bool __stdcall TuxedoStart(char * cWsnAddr/*[in]*/,
char *error/*[in/out]*/,
int *errorlen/*[in/out]*/);//初始化,必须先调用
extern "C" DllExport bool __stdcall TuxedoGetUserInfo(char *cUsrNo/*[in]*/,
char *error/*[in/out]*/,
int *errorlen/*[in/out]*/,
stUserInfo *pUserInfo/*[in/out]*/);
extern "C" DllExport void __stdcall TuxedoEnd(); //调用释放现在导入调用,可是怎么都不对:
[DllImport("Tuxedo.dll", EntryPoint="TuxedoStart", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
static extern bool TuxedoStart(ref String cWsnAddr, ref String error, ref int errorlen); [DllImport("Tuxedo.dll", EntryPoint="TuxedoGetUserInfo", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
static extern bool TuxedoGetUserInfo(ref String UserNo, ref String error, ref int errorlen, ref UserInfo info); [DllImport("Tuxedo.dll", EntryPoint="TuxedoEnd", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
static extern void TuxedoEnd();调用方法:
string cWsnAddr = 192.168.1.16";
String error = "";
int errorlen = 0;
UserInfo MobileUser = new UserInfo();
bool bSuccess = TuxedoStart(ref cWsnAddr, ref error, ref errorlen);调用报错:System.NullReferenceException: 未将对象引用设置到对象的实例请教各位高手, 我应该怎么去调用, 写的导入式是否有错呢? 我调系统的dll都可以, 自己定义的这个可能是类型的不同! 感谢感谢!
extern "C" DllExport bool __stdcall TuxedoStart(char * cWsnAddr/*[in]*/,
char *error/*[in/out]*/,
int *errorlen/*[in/out]*/);//初始化,必须先调用
extern "C" DllExport bool __stdcall TuxedoGetUserInfo(char *cUsrNo/*[in]*/,
char *error/*[in/out]*/,
int *errorlen/*[in/out]*/,
stUserInfo *pUserInfo/*[in/out]*/);
extern "C" DllExport void __stdcall TuxedoEnd(); //调用释放现在导入调用,可是怎么都不对:
[DllImport("Tuxedo.dll", EntryPoint="TuxedoStart", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
static extern bool TuxedoStart(ref String cWsnAddr, ref String error, ref int errorlen); [DllImport("Tuxedo.dll", EntryPoint="TuxedoGetUserInfo", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
static extern bool TuxedoGetUserInfo(ref String UserNo, ref String error, ref int errorlen, ref UserInfo info); [DllImport("Tuxedo.dll", EntryPoint="TuxedoEnd", CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
static extern void TuxedoEnd();调用方法:
string cWsnAddr = 192.168.1.16";
String error = "";
int errorlen = 0;
UserInfo MobileUser = new UserInfo();
bool bSuccess = TuxedoStart(ref cWsnAddr, ref error, ref errorlen);调用报错:System.NullReferenceException: 未将对象引用设置到对象的实例请教各位高手, 我应该怎么去调用, 写的导入式是否有错呢? 我调系统的dll都可以, 自己定义的这个可能是类型的不同! 感谢感谢!
can not use them directly.
they should be wrappered by RCW(runtime callable wrapper)
use TlbImp.exe to tranform your dll files to .net format dll files.
then reference it and it may be work