--------------------------------------------------------------------------------
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 on 2006-02-27 16:52 Azusa 阅读(598) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理