几何尺寸与公差论坛------致力于产品几何量公差标准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-04, 04:39 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】bb6 problems

bb6 problems
bb6 problems
hallo,
i'll port our source to the new dd with bb6,
at first i tried to make a simple viewer, my problems are:
-i cannot link the wd libs:
[linker error] unresolved external '_errno' referenced from g:\opendwg2006\bb6lib\bb6wd\dd_bb6wd_root.lib|odgd toaimp
the link with the wm ist successful...
what are the difference between the wd and wm libs??
-the second is harder to understand
the reduced sources:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "frmsimple.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
// dwgdirect
#include "odacommon.h"
#include "dbdatabase.h"
// dwgdirect os extensions
#include "exsystemservices.h"
#include "exhostappservices.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "tntbuttons"
#pragma resource "*.dfm"
// link dwgdirect libraries
#pragma link "dd_bb6wm_root.lib"
#pragma link "dd_bb6wm_alloc.lib"
#pragma link "dd_bb6wm_db.lib"
#pragma link "dd_bb6wm_gi.lib"
#pragma link "dd_bb6wm_gs.lib"
#pragma link "dd_bb6wm_ge.lib"
#pragma link "dd_bb6wm_spatialindex.lib"
#pragma link "dd_bb6wm_ft.lib"
//bb stuff
tformsimple *formsimple;
class myservices : public exsystemservices, public exhostappservices
{
public:
void addref() {}
void release() {}
virtual ~myservices()
{
int a = 1;
}
protected:
odrx_using_heap_operators(exsystemservices);
};
myservices odservice;
//---------------------------------------------------------------------------
__fastcall tformsimple::tformsimple(tcomponent* owner)
: tform(owner)
{
odinitialize(&odservice);
}
void __fastcall tformsimple::formdestroy(tobject *sender)
{
oduninitialize();
}
void __fastcall tformsimple::button1click(tobject *sender)
{
oduninitialize();
}
at oduninitialize() in formdestroy() the programm crashes.
i checked, the dtor of myservices, it was'nt called until formdestroy, so
i think the object is valid here. if i comment the call in destroy and do that stuff on the buttonclick, it works.
the error message from the runtime system is: "pure virtual function called"
my opinion: here is a pure virtual funtion from a base-class is called, and the implementaton of the real one was already destroyed.
class
what is wrong here?
is there anything asychronous in oduninitialize()?
ore is global stuff in the libs is destroyed before the call?
the callstack is in the image
attached images
quote:
what are the difference between the wd and wm libs
please, carefully check that the same flags are used. for instance, -twd not -twm, and etc.
this topic was brought up some times here.
also faq should keep some notes concerning bb6.
misha kuzinets
quote:
originally posted by misha kuzinets
please, carefully check that the same flags are used. for instance, -twd not -twm, and etc.
this topic was brought up some times here.
also faq should keep some notes concerning bb6.
hallo misha,
i think the compiler settings are ok there.
if you have got a borland builder, the error is simple reproduceable,
might be that the crash is not a problem of ddwg, i have found that the call of
formdestroy is placed after winmain from the vcl.
its easy to workaround here.
are you shure that the linker error is a settings problem?
please, check this (from faq) :
dwgdirect is throwing exceptions under borland c++ builder or metrowerks codewarrior.
make sure that you are using default data alignment (dwgdirect is built with default alignment on all platforms).
do not use the -b- (makes enums byte-sized when possible) option with the borland compiler. this option introduces errors into dwgdirect with some of our color enums, so it cannot be used (even if dwgdirect is built from source).
in codewarrior, the "enums always int" flag should not be checked, as dwgdirect is not built with this option. enabling this option in client apps will result in misaligned structures, causing unpredictable errors.
misha kuzinets
quote:
originally posted by misha kuzinets
please, check this (from faq) :
dwgdirect is throwing exceptions under borland c++ builder or metrowerks codewarrior.
make sure that you are using default data alignment (dwgdirect is built with default alignment on all platforms).
do not use the -b- (makes enums byte-sized when possible) option with the borland compiler. this option introduces errors into dwgdirect with some of our color enums, so it cannot be used (even if dwgdirect is built from source).
in codewarrior, the "enums always int" flag should not be checked, as dwgdirect is not built with this option. enabling this option in client apps will result in misaligned structures, causing unpredictable errors.
hi misha
the crash is definitively not a result of a false setting "treat enums always int" here, look at the code:
if i call oduninitialize() at buttonclick and not at formdestroy, it works fine.
as i said, may be that the vcl do some special things here.
michael
pure virtual function call occurs if an object's virtual function is called after object is destroyed already. it may happen if some related static objects are being destroyed because the order of destoying static objects is unpredictable.
or it may happen if by the moment oduninitialize is called not all db objects are destroyed (probably smart pointers exist holding them). the order in which things happen must be the following:
1. services object is created.
2. odinitialize() is called.
3. db code working (loading files, creating and modifying db objects, file save etc.
4. all db objects are destroyed. smart pointers must go out of scope or be zeroed to release db objects.
5. oduninitialize() is called.
6. services object is destroyed.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】aix problems yang686526 DirectDWG 0 2009-05-04 03:54 PM


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


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