2007年10月7日

     摘要: 1.概论  先来阐述一下DLL(Dynamic Linkable Library)的概念,你可以简单的把DLL看成一种仓库,它提供给你一些可以直接拿来用的变量、函数或类。在仓库的发展史上经历了“无库-静态链接库-动态链接库”的时代。 [被屏蔽广告]  静态链接库与动态链接库都是共享代码的方式,如果采用静态链接库,则无论你愿不愿意,lib中的指令都被直接包含在最终生成的EX...  阅读全文
posted @ 2007-10-07 22:11 Azusa 阅读(1954) | 评论 (0)编辑 收藏

2006年2月28日

打造网络服务,提供专业知识
posted @ 2006-02-28 08:36 Azusa 阅读(255) | 评论 (0)编辑 收藏

2006年2月27日

--------------------------------------------------------------------------------
Hello everybody,

Please consider this:

1. I have a few ARX's all using the same functions. So I put the common
functioms in foo.dll and every ARX uses the dll.

2. Some of the functions in the dll use ObjectARX functions.

3. In acad2000 everything works OK (well, almost - a few ARX's
developed a slightly erratic behaviour).

4. Now I try to migrate to acad2004 (using VS 2002). I built foo.dll
and, as a test project, loo.arx. Everything is compiling OK,
but arxloading loo.arx causes an unhandled exception.

Can anybody please give me a clue and/or references? It's obvious I
miss or don't understand something.

Thank you,

alex

--------------------------------------------------------------------------------
So as your dll links against ARX Modules, it depends on those modules to
be loaded by the Rx System using the dynamic linker. Windows will load
them for you if needed, however, it will not call the acrxentrypoint
function, wich might lead to ARX Modules that are not connected to the
RX system.
As you allready depend on ARX, I would recommend to make your DLL an ARX
DLL and load it by your other ARX modules that depend on it using the
dynamic linker.
--------------------------------------------------------------------------------
The erratic behaviour might come from what I wrote above

Where does this exception occur? Have you debbugged it? BTW, you can set
you debugger to break when an exception is thrown under
Debug|Exceptions: Mark C++ Exception and Win32 Exceptions and select
"Break into the ..." under "When Exception is thrown"
As said, I would recommend to change your DLL into an ARX(DBX) DLL and
load it from your other ARX modules using the dynamic linker. This will
most likely eliminate your problems.
HTH,
Andy
--------------------------------------------------------------------------------
Do you mean building the dll as .DBX and explicitly loading it at
acrxEntryPoint() in my ARX?
The dll contains functions which have to be available for other ARX's as
well, so I presume I have
to make the acrxLoadModule() call in every ARX which uses those funcs, and
that in addition
to the implicit loading by the OS..
It also implies (?) I have to link every ARX to this DBX.

--------------------------------------------------------------------------------
I don't know enough about debugging and just moved to VS2002. I heard about
problems debugging under acad2004.
Could you elaborate?
(I could post the Autocad message window with the exception.)

Thank you,
alex

--------------------------------------------------------------------------------
yes. And in you "converted" DLL, call acrxLoadModule() for each other
ARX this DLL depends on. This will ensure that everything is initialized
correctly. (Don't forget to unload them in you unload sequence :-) )

--------------------------------------------------------------------------------
yes.

As I understood the OP, your DLL is allrady using ARX stuff. This means
that it allready links to ARX modules and can't be used outside an
DBX/ARX context. Additionally your other ARX must allready link against
yor DLL. So actually the linking stays as it was and you loose nothing

--------------------------------------------------------------------------------
To make it short: There are issues with debbugging. There is an Addin in
your SDK, that should solve this, howver, it does not seem to work for
some people. Just try it out. Hit F5, enter the path to acad.exe. If it
works, be happy :-). If it doesnot, do the following:
-Uninstall the addIn
-Start Acad manually
-In VS, go Debug|Processes..
-In the "Available Processes" list, choose acad.exe And hit "Attach"
-Hit "Close"
-put a breakpoint in your acrx entrypoint function using F9
-goto acad, load your arx. It should jump into te debugger
-use F10 to step through, F11 to step into a function.
-At some point the exception will fly. If this is one of your functions,
investigate it by stepping into it, if it is ARX stuff, look at the
documentation and/or come back here with this specific code snippet. We
are happy to help :-)

Sometimes it takes a while for te debugger to break in the first time
and the system seems to hang. Just wait a bit....
--------------------------------------------------------------------------------
The .dbx extension is typically used when you are defining a custom
entity and it does not link with AutoCAD (acad.exe or any of the dll's
in the same folder). If that's not the case, the arx extension is more
appropriate and perfectly acceptable.

Also I find it easier to keep track of linkages by including a #pragma
for the link in the main .cpp file rather than as a linker setting.
This way the call to acrxLoadModule and the #pragma are in the same
file. If anything changes I don't have to go several different places.

If you have several arx's and/or dbx's that have specific dependencies
it may be easier to just create a loader arx that loads the all others
(via acrxLoadModule) in the appropriate order. This way the user or
installer only needs to load the one arx...

--
Best regards,

Byron Blattel

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
posted @ 2006-02-27 16:52 Azusa 阅读(617) | 评论 (0)编辑 收藏
 
从DLL的角度,把一个ARX当作一个DLL文件来调用,同样可以调用已经定义的函数,详见附件例程
(附件有两个工程,第一个定义了可以输出的外部函数,第二个调用了第一个工程生成的ARX里的函数)

但这个方法只是生硬的调用了函数,没有实现不同ARX间的“通讯”。还有就是怎么调用已定义的类,还没学会,谁有经验,可否借鉴。

当然我们可以用COM,不过代码量很大。

更好的办法是做一个公共的类,在每个工程存在,各个工程通过公共类的虚函数访问!

如果用COM还不如就用acedRegFunc()登记命令讲究吧(虽然它本质上是ADS的处理方法)
不过我很奇怪,ACAD加入加载了ARX到内存了,就没办法把它共享给其他ARX吗?
posted @ 2006-02-27 16:43 Azusa 阅读(837) | 评论 (2)编辑 收藏
 

.net wrapped managed code, 是将来的发展方向。应该给以注意。

posted @ 2006-02-27 14:37 Azusa 阅读(183) | 评论 (0)编辑 收藏
仅列出标题