几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-06, 11:52 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】problems with dll project using dwgdirect 2

problems with dll project using dwgdirect 2.x
problems with dll project using dwgdirect 2.x
hi,
since moving to dwgdirect 2.x (first 2.0.2 and now 2.1.0) i'm having problems with a dll project that uses dwgdirect and worked fine for years now with dwgdirect 1.x. the problem is that now everytime i call
oddbgsmanager::setupactivelayoutviews(...)
an unknown exeption is throw (not sure if it's a standard c++ one but i'm sure it's not a dwgdirect "oderror"); the exception is really on thrown at this point, file loading and many other dwgdirect operations work.
now i first (sure) thought that this is a coding problem but then i noticed something really strange: when i call odinitialize() from the main process and not from inside the dll the code works! the thing is, the same dll is used by many projects and one of them is a exe that uses dwgdirect also (for viewing purposes) and in this case odinitialize() is called by the main process and not from the dll.
well, after realizing this i thought that i might have some strange library mixing problem or something like that and tried to compile the dll with /md, /mdd or /mt options but none of them worked.
i know that this might be some obscure problem in our code or some other linking issue, but as i'm really running out of ideas of what might be happening i thought that maybe someone can give me at least one hint on where to look.
writing i'm also realized that this only happened after we migrated to visual c++ 7.1 and it might be related but it will be difficult to be sure since both migrations (dwgdirect 2.x + vs 2003) happened at the same time.. i can only say that the comination visual studio 6 + dwgdirect 1.14 worked like a charm.
here some more details of the project in question:
- dll: vs 2003 + atl
- exe (also using dwgdirect): vs 2003 + mfc
any help really appreciated,
thanks,
tiago gehring
if dd is used both in dll and in the applicaiton, then, perhaps it would be reasonable to call odinitialize from the applicaiton.
where your "services" object resides?
/mt means static c runtime, and certainly should not be used in dll+exe scheme.
dd dlls are compiled with /md in release mode, and /mdd in debug mode.
vladimir
yeah, sorry for the misunderstandig - i tried to compile the dll only with "debug multithreaded dll" or "debug multithreaded", i wrote down the switches from my head..
anyway, as i mentioned in the case of exe + dll (that works) i call odinitialize from the exe (and hence the "services" object resides there also). the case that doesn't work is when i'm using the dll via another application - not using dwgdirect - and call odinitialize from the dll (in this case the services object resides in the dll)...
that is strange, because our activex wrapper works also when compiled with 7.1 (it has it's own services)
(when i say 'works', i mean oddbgsmanager::setupactivelayoutviews works too, e.g. in exports)
what is the application call stack in debug mode, after the crash?
it is good idea to call odrxsystemservices(), before calling odinitialize(), to make sure dd is not inilialized yet.
vladimir
also, i static linked the dll now and this is the call stack after the crash:
dwgedit.dll!odqueryximpl<odgsviewimpl,odgsview>(co nst odgsviewimpl * pthis=0x01aeb708, const odrxclass * pclass=0x01ab1cb0) line 799 + 0x15 c++
dwgedit.dll!odgsviewimpl::queryx(const odrxclass * pclass=0x01ab1cb0) line 43 + 0x1b c++
> dwgedit.dll!odsmartptr<odabstractviewpe>::internal queryx(const odrxobject * pobject=0x01aeb708) line 131 + 0x13 c++
dwgedit.dll!odsmartptr<odabstractviewpe>:dsmartp tr<odabstractviewpe>(const odbaseobjectptr & pobject={...}) line 222 c++
dwgedit.dll!oddbgsmanager::_setupmodelviews(odgsde vice * pdevice=0x01bda5c0, odgicontextfordbdatabase * pgictx=0x01bd3350) line 517 + 0x12 c++
dwgedit.dll!oddbgsmanager::setupactivelayoutviews( odgsdevice * pdevice=0x01bda5c0, odgicontextfordbdatabase * pgictx=0x01bd3350) line 608 + 0x11 c++
the error occurs at the line
odrxobject* px = pobject->queryx(t::desc());
of the function internalqueryx(..) of the smartptr class.
thank you really for the help,
tiago
the problem is really obscure then. it looks like oddbgsmanager refers to dd that was not initialized, because odabstractviewpe is attached to odgsview in odinitialize() (in function called from odinitialize)
try to overload odrxsystemservices::loadmodule(), and see if it is called for dd_db.dll
vladimir
hi,
you're right, i did as you said - overloaded the loadmodule() function - and saw that the loading of the dd_db library indeed fails (all others load ok);
now the question is why, i tried the debug and release version of the dlls, double checked if i don't have a mixing of old and new dlls and used depends.exe to search for missing libraries (none), nothing really helped;
any idea of what might be causing this?
thanks again for your help!
tiago
i've no more ideas. maybe you can produce some sample to reproduce the problem?
vladimir
hi vladimir,
thanks again for the attention but i also ran out of ideas (and time) - the solution i adopted was to simply use the new pdf-conversion feature directly from dwgdirect since the code in question was merely another pdf generator that i wrote long ago (for dwgdirect 1.0x or something like this). it's working like a charm now..
thanks again!
tiago
we are having the same exact problem. the exception appeared after we upgraded to version 2.1.0 of the sdk. the exception is thrown from the same location. the project is an activex component linked to the multithreaded dll debug libraries.
any clues?
no, sorry, i really didn't find out where the problem lies. it may be ole/com related as both projects use it but then there's also the dwgdirectx library that works fine.
in my case calling the "odinitialize" function from an exe process worked, maybe you can test this also? (initializing dwgdirectx before calling your dll may work also, didn't test that). sure, this would only help to see if your problem is the same i had.
one thing that i'm reacalling now that i did notice is that i had problems only with my custom developed rendering device. is it the same for you? in my case it was a pdf converter and i tested calling one of dwgdirect standard devices just to see if it worked and i had no problems with them..
good luck,
tiago
and you are also loading activex in the context of the exe, that uses dd?
vladimir
sorry, i'm not sure if i understood the question.. i'm not using dwgdirectx directly in my project but our dll that uses dwgdirect is also loaded via com and it may be related..
this was a question for lars
i asked if his configuration is the same as yours
vladimir
please check if it's possible that the following happens:
- dll is loaded and odinitialize() is called from dll (services object residing in dll is used for dd initializing)
- dll is unloaded. at this moment odunitialize() is called.
- exe uses dwgdirect. by this moment it's uninitialized. or even if odunitialize() was not called services object passed to odinitialize() is destroyed (because it was residing in dll).
this can explain why everything works if dd is initialized from exe.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】numerous link errors on macosx 9xcode 2.50 yang686526 DirectDWG 0 2009-05-06 06:43 PM
【转帖】error while linking using mfc static library vc 96.00 yang686526 DirectDWG 0 2009-05-05 09:49 AM
【转帖】dll学习(资料收集) huangyhg vc编程 0 2008-05-17 09:24 PM
最难清除木马 Dll木马揭秘 huangyhg vc编程 0 2007-04-12 07:31 PM
regsvr32.exe的使用 cam 论坛管理 0 2007-02-27 11:07 PM


所有的时间均为北京时间。 现在的时间是 03:04 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多