您的位置:程序门 -> vc/mfc -> 进程/线程/dll



ntdll! 7c921230()问题!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


ntdll! 7c921230()问题![已结贴,结贴人:qq14923349]
发表于:2007-10-13 20:31:12 楼主
烦恼的ntdll!   7c921230()问题!
我写了一个mfc程序并连接共享dll,谁料
第一次连接,ok,但是第二次,就出现
user   breakpoint   called   from   code   0x7c921230()
怎么解决啊?

我的dll返回的是cstring类型,不过跟这个问题不大吧?lpstr?
发表于:2007-10-13 20:59:401楼 得分:5
你把导出函数的代码贴出来吧
发表于:2007-10-13 21:11:092楼 得分:0
我试过了
不用dll的情况下程序不出现那个错误.

handle   handle;
cstring   gstr;

//第二种dll测试,共享dll
cstring   linkanddealdll()
{
cstring   str;
cstring   s1;
dword   dwerror=0;

if(handle   ==null)
handle=   createfile("com1",   generic_read   ¦   generic_write,   0,   null,   open_existing,   0,   null   );

省列..................
//-----------------------------------------------
.h  
#ifndef   lib_h
#define   lib_h

cstring   __declspec(dllexport)linkanddealdll();
void   combine();

#endif  
//------------------------------------------------
.def
exports
linkanddealdll

发表于:2007-10-13 21:20:393楼 得分:0
你贴出来的代码太少了

如果你dll和调用程序的代码都有,自己跟踪调试一下不就行了
发表于:2007-10-14 10:27:334楼 得分:10
1)如果是写成dll文件,最好不要使用cstring,因为可能其他的语言没有这个类型的参数。
2)if(handle   ==null)   判断句柄无效有问题.
发表于:2007-10-14 10:45:095楼 得分:5
楼上说得对,
如果用返回值的话,linkanddealdll()生命周期结束时已经释放了,返回的是空字串,最好用输出参数带出来
发表于:2007-10-14 18:16:506楼 得分:0
cstring   linkanddealdll()
{
handle   handle=null;
cstring   str;
cstring   s1;
dword   dwerror=0;

if(handle   ==null)
handle=   createfile("com1",   generic_read   ¦   generic_write,   0,   null,   open_existing,   0,   null   );

dcb   dcb;
getcommstate(handle,&dcb);

dcb.baudrate   =   9600;   //波特率为9600
dcb.bytesize   =   8;   //数据位数为8位
dcb.parity   =   noparity;   //偶校验
dcb.stopbits   =   onestopbit;   //两个停止位
dcb.fbinary   =   true;
dcb.fparity   =   true;

commtimeouts   timeouts;
//设定读超时
//在读一次输入缓冲区的内容后读操作就立即返回,
//而不管是否读入了要求的字符。
timeouts.readintervaltimeout=maxdword;
timeouts.readtotaltimeoutmultiplier=0;
timeouts.readtotaltimeoutconstant=0;
timeouts.writetotaltimeoutmultiplier=100;//设定写超时
timeouts.writetotaltimeoutconstant=500;
setcommtimeouts(handle,&timeouts);   //设置超时

setupcomm(handle,   1024,   1024);
purgecomm(handle,purge_rxabort   ¦   purge_txclear   ¦   purge_rxclear);

if   (!setcommstate(handle,   &dcb))
{
messagebox(null,"串口设置出错!",   "串口设置",   null);
return   "false";
}  
else
{
}

combine(handle);
// handle=null;
closehandle(handle);
return   gstr;
}
发表于:2007-10-14 18:20:387楼 得分:0
1,应该如何判断句柄为空?
2,我另外写了个简单的程序连接该dll,也有这个问题,后来我改了下.cpp
handle   handle=null;  
cstring   linkanddealdll()  
{  

转换为
cstring   linkanddealdll()  
{  
handle   handle=null;  

就没出现那个
user   breakpoint   called   from   code   0x7c921230()  
但是我依样写了回原程序,又是第二次就出现
user   breakpoint   called   from   code   0x7c921230()  
郁闷


快速检索

最新资讯
热门点击