- UID
- 5280
- 积分
- 9466
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-18
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
AcDbObjectId == Operator Causes Crash in Mixed Managed /CLR code
问题:
Any use of the == operator with AcDbObjectId causes a crash in my AutoCAD 2005 or AutoCAD 2006 code. What can I do to avoid this? Example:
AcDbObjectId ida, idb;
if(ida == idb)
acutPrintf(_T("Ids Match!"));
解答:
The problem with this code is that the managed compiler has a forward declaration of the class which AcDbObjectId wraps called AcDbStub, which it does not have a managed definition for - but links with an unmanaged module that does. From MSDN:
"...can occur when there is only a forward declaration for a type in an MSIL module (compiled with /clr), where the type is referenced in the MSIL module, and where the MSIL module is linked with a native module that has a definition for the type."
The quick solution for this is to give the managed code a dummy definition for this wrapped type by adding:
class AcDbStub {};
in your CPP code before the code you use the comparison with.
|
|