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

using odbrbrepedgetraverser in a dll
using odbrbrepedgetraverser in a dll
a quick background history first:
we use borland builder 6, but because of problems with the dwgdirect borland libraries have decided to create a dll using visual studio 2005 and then make calls to this from our borland application.
this seems to work fine except when i try to use the edge traverser. the code looks a bit like this:-
odbrbrep brep;
if ( pent->iskindof( oddbregion::desc() ) )
oddbregionptr( pent )->brep( brep );
odbrbrepedgetraverser bet;
bet.setbrep( brep );
this worked ok when we linked dwgdirect as a static library, but now i get an 'unhandled exception' at the call to setbrep.
i know i am supposed to have modelergeometry.drx, but i'm not sure where it should go. should it be in the same location as my borland executable, my visual studio dll or somewhere else?
also, should it be renamed from modelergeometry_2.03_8.drx to modelergeometry.drx or should it retain that name?
a further complication to my situation is that i have made another visual studio application which i can use to call the dwgdirect dll as this is the only way i can debug the dwgdirect dll. again, i'm not sure where modelergeometry.drx should go.
i hope i have made myself clear with this explanation.
last edited by geoff@ardensoftware.com; 8th february 2008 at 01:45 amfff">.
i think that modeler.drx should be with all other toolkit drx. usually it is application.exe folder.
thanks for the response, alexander. i've tried putting modelergeometry_2.03_8.drx (and a copy of it renamed as modelergeometry.drx) into the same folder as my borland application.exe and i still get the same problem.
any more ideas anyone?
could you please check the next code
code:
#define rx_modeler_geometry_appname dd_t("modelergeometry")
odrxclassptr pservice = odrxservicedictionary()->getat(dd_t("odmodelergeometrycreator"));
if (pservice.isnull())
{
odrxmoduleptr pmodule = odrxdynamiclinker()->loadapp(rx_modeler_geometry_appname);
if (pmodule.get())
{
pservice = odrxservicedictionary()->getat(dd_t("odmodelergeometrycreator"));
}
}loadapp(rx_modeler_geometry_appname)
should return non null value.
did you use any other drx with your application ? please, test this drx name with load code.
may be problem in the filefind function of application.
this won't compile for me, alexander. i get the following compiler error:-
smartptr.h(334) : error c2440: 'static_cast' : cannot convert from 'odrxobject *' to 'odrxmodule *'
types pointed to are unrelated; conversion requires reinterpret_cast, c-style cast or function-style cast
smartptr.h(333) : while compiling class template member function 'odrxmodule *odsmartptr<t>::get(void)'
with
[
t=odrxmodule
]
cdwgfile.cpp(36) : see reference to class template instantiation 'odsmartptr<t>' being compiled
with
[
t=odrxmodule
]
no, i don't use any other .drx files.
unfortunately, i won't have time to look at this any further until monday. thanks for your help so far.
have a good weekend.
ok, replace odrxmoduleptr to odrxobjectptr. you don't need type - just a result.
sorry, alexander, i was in a bit of a rush on friday.
in fact i could compile your original code, i just needed to #include "rxmodule.h"
so now i can see that loadapp is returning a null value.
hi,
i have checked the code of loadapp. the last call is
code:
hmodule hmodule = loadlibrary(name)so the next 'strong' drx name should work...
code:
odrxmoduleptr pmodule = odrxdynamiclinker()->loadapp(dd_t("d:\\modelergeometry"));also search rules for modelergeometry is standard search rules for windows loadlibrary:
the directory where the executable module for the current process is located.
the current directory.
the windows system directory. the getsystemdirectory function retrieves the path of this directory.
the windows directory. the getwindowsdirectory function retrieves the path of this directory.
the directories listed in the path environment variable.
hi alexander,
ok, i've put a copy of modelergeometry.drx into the following places:-
the windows directory
the location of the .exe
the location of the .vcproj (which i presume is the current directory)
at least one location from my path environment variable.
i've tried this with both dd_t("d:\\modelergeometry") and dd_t("modelergeometry") and still loadapp is returning a null value.
thanks,
geoff
hi alexander,
i don't know if this helps, but i tried the following line of code:-
code:
hmodule hmodule = loadlibrary( "modelergeometry.drx" );and got the following message:-
"application failed to start because dd_alloc_2.03_8.dll was not found..."
however, i do have dd_vc8md_alloc.lib in my list libraries.
thanks,
geoff
second thoughts, that probably isn't anything. i've copied all the .dll files from exe\vc8\release into the application.exe folder and the loadlibrary function works ok, but no change with loadapp.
try loadapp with full path to your application. it should load drx.
application is in d:\dwgdirect 2.03.01\exe\vc8\debug
i've tried:-
code:
odrxmoduleptr pmodule = odrxdynamiclinker()->loadapp(dd_t("d:\\dwgdirect 2.03.01\\exe\\vc8\\debug\\modelergeometry"));and
code:
odrxmoduleptr pmodule = odrxdynamiclinker()->loadapp(dd_t("d:\\dwgdirect 2.03.01\\exe\\vc8\\debug\\modelergeometry.drx"));and they both return null.
i'm getting rather confused, now. i've built this dll based around the odreadex example, but i've just realised there is also an odreadexdll example. this example uses library files such as dd_db_dll.lib etc., whereas i am using dd_vc8md_db.lib etc. (however, this example is still generating a .exe - i am generating a .dll)
should i be using these .lib files? i've tried replacing all my .lib files with the equivalent ones, but i get lots of unresolved externals, which isn't encouraging.
hi,
you should use name like in the mfcapp = rx_modeler_geometry_appname dd_t("modelergeometry")
index and .drx will be add inside loadapp. you shouldn't rename modelergeometry_2.03_8.drx to modelergeometry.drx.
i see only two reasons why it cannot be loaded:
- folder isn't application exe.
- missed linked dll in exe folder.
you said that loadlibrary was loaded for release after all dlls were moved to application.exe folder. i think that it will be loaded too for debug, after debug dlls moving. it is very strange that loadlibrary is succeed, but loadapp - not. loadapp just add .drx index and '2.3_8' to file name and call for loadlibrary.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】linking in dll yang686526 DirectDWG 0 2009-05-06 05:07 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


所有的时间均为北京时间。 现在的时间是 06:37 AM.


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