调用dll以后出现混乱

rongtong 2003-03-04 09:53:13
使用LoadLibrary() 从dll中调出函数使用以后,会对使用该函数的函数中定义的字符串变量造成影响,有点像内存空间混乱了~~但如果定义一个int数组,不用,就没有问题,不定义就会出错~~~
你们遇到过没有??
...全文
28 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2003-04-11
  • 打赏
  • 举报
回复
To rongtong:
不好意思,我好像发不了消息!你搜查一下我以前的贴子吧!
请参见:http://expert.csdn.net/Expert/topic/1560/1560866.xml?temp=.2928125
rongtong 2003-03-05
  • 打赏
  • 举报
回复
程序如下:
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
dll=LoadLibrary("WX_Mif1low.dll");
if(!dll)
{
ShowMessage(SysErrorMessage(GetLastError()));
}
//*OpenComport=new FunParaC;
OpenComport=(FunParaC *)GetProcAddress(dll,"CommInit");
CloseComport=(FunParaV *)GetProcAddress(dll,"CloseCommPort");
Mf_Request=(FunParaUCUCp *)GetProcAddress(dll,"mifs_request");
Mf_Anticoll=(FunParaUCUCp *)GetProcAddress(dll,"mifs_anticoll");
ResetReader=(FunParaCp *)GetProcAddress(dll,"icdev_ATR");
CardConnect=(FunParaUC *)GetProcAddress(dll,"ic_CardConnect");
ResetCard=(FunParaUCpUCp *)GetProcAddress(dll,"ic_Reset");
Sendata=(FunParaUCpUCUCpUCp *)GetProcAddress(dll,"ic_t0apdu");
DES1=(Math *)GetProcAddress(dll,"mif_des1");
DES3=(Math *)GetProcAddress(dll,"mif_des3");
Comport='1';
}

...
...
...

void __fastcall TForm1::AAnticollExecute(TObject *Sender)
{
__int16 temp,i_temp[10];//如果不定义i_temp[10]在for循环中会出错,i的值被改变。
unsigned char *c_temp;

if(!Mf_Anticoll)
if (Application->MessageBox("Could not find fun in dll!!!",
NULL, MB_OK) == IDOK)
return;
c_temp = new unsigned char [6];
temp=Mf_Anticoll(0,c_temp); //不使用这个dll中的函数也不会出错
StatusBar1->Panels->Items[0]->Text=temp;
StatusBar1->Panels->Items[1]->Text="";

for (int i=0;i<4;i++)
{
StatusBar1->Panels->Items[1]->Text = StatusBar1->Panels->Items[1]->Text
+ IntToHex(c_temp[3-i],2) + " ";
}
delete(c_temp);
}

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧