Order of autoloading .NET and ARX applications

Order of autoloading .NET and ARX applications

Anonymous
Not applicable
735 Views
8 Replies
Message 1 of 9

Order of autoloading .NET and ARX applications

Anonymous
Not applicable
I am auto loading an ARX file for a custom entity using the ACAD.RX file.

I am also trying to auto load a managed wrapper dll for the custom entity by creating a registry entry. This managed wrapper needs to have the ARX loaded prior to its loading.

However, the auto load of the managed wrapper fails. It appears ACAD loads .NET files from the registry before the ACAD.RX files are loaded. This is causing my .NET dll to fail in loading.

How can I load the ARX and .NET wrapper file in the ARX first followed by .NET wrapper order?

Thank you.
0 Likes
736 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
I believe, the easiest way to solve the problem is, to put both files in the registry.

Autocad loads the apps in the order they are stored in the applications key. So just put your arx module before the .net wrapper in this key (alphanumeric order) and everything should work fine.
0 Likes
Message 3 of 9

Anonymous
Not applicable
Thanks for you response that seems like a good solution.

Do you know what one of those string values mean? I don't know what LOADCTRLS mean?
0 Likes
Message 4 of 9

Anonymous
Not applicable
You should never rely on AutoCAD to load your modules in a specific order.
Your .NET dll should load any dependent DLLs (including your .arx module)
before it needs them. 🙂
--
Owen Wengerd
President, ManuSoft <>
VP Americas, CADLock, Inc. <>


wrote in message news:6087875@discussion.autodesk.com...
I am auto loading an ARX file for a custom entity using the ACAD.RX file. I
am also trying to auto load a managed wrapper dll for the custom entity by
creating a registry entry. This managed wrapper needs to have the ARX loaded
prior to its loading. However, the auto load of the managed wrapper fails.
It appears ACAD loads .NET files from the registry before the ACAD.RX files
are loaded. This is causing my .NET dll to fail in loading. How can I load
the ARX and .NET wrapper file in the ARX first followed by .NET wrapper
order? Thank you.
0 Likes
Message 5 of 9

Anonymous
Not applicable
Thanks for the reply Owen.

I am assuming I need to use LoadModule and LoadApp functions on the DynamicLinker. What is the difference between the two functions? Which one should I be using with the .NET application? The documentation didn't make that clear!

Thanks again.
0 Likes
Message 6 of 9

Anonymous
Not applicable
If you configure your .arx module for demand loading, you can use
LoadApp(), but for debug builds it's usually best to use LoadModule to
ensure that you load the debug build of your .arx as well. 🙂
--
Owen Wengerd
President, ManuSoft <>
VP Americas, CADLock, Inc. <>


wrote in message news:6088232@discussion.autodesk.com...
Thanks for the reply Owen. I am assuming I need to use LoadModule and
LoadApp functions on the DynamicLinker. What is the difference between the
two functions? Which one should I be using with the .NET application? The
documentation didn't make that clear! Thanks again.
0 Likes
Message 7 of 9

Anonymous
Not applicable

Managed wrappers for custom objects should load the native ARX
or DBX for the custom object, before any instance of the managed wrapper is
created, or the RXClass for the custom object is used.

 

For example, someone might use the RXClass of a managed
wrapper in a call to PromptEntityOptions.AddAllowedClass(), quite possibly
before the native module that registers the underlying AcRxClass has been
loaded.

 

If the native component is not loaded at that point, the
AcRxClass for the custom object will not be found, and AutoCAD will crash (there
is currently a bug in the RasterImage managed wrapper, which fails to do exactly
what I describe above, and calling AddAllowedClass(typeof(RasterImage)) before
acismobj17.dbx is loaded, leads to a fatal error).

 

The best way to deal with that is to ensure that your
ARX/DBX is loaded from the static constructor of the managed wrapper, so
that if someone tries to use your managed wrapper's RXClass by referencing it
via the managed wrapper's type (e.g., by using RXClass.GetClass()), the native
component will be loaded at that point; it will register the AcRxClass; and the
call to GetClass() will succeed.

 


 

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000
through 2009

href="http://www.acadxtabs.com">http://www.acadxtabs.com

 


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
am auto loading an ARX file for a custom entity using the ACAD.RX file. I am
also trying to auto load a managed wrapper dll for the custom entity by
creating a registry entry. This managed wrapper needs to have the ARX loaded
prior to its loading. However, the auto load of the managed wrapper fails. It
appears ACAD loads .NET files from the registry before the ACAD.RX files are
loaded. This is causing my .NET dll to fail in loading. How can I load the ARX
and .NET wrapper file in the ARX first followed by .NET wrapper order? Thank
you.
0 Likes
Message 8 of 9

Anonymous
Not applicable
Tony/Owen,

I have the ARX of the custom entity loading the DBX. So, the next logical question is, how do I load the ARX from my managed wrapper?

Also, I looked into the managed wrapper class header and I don't see the constructor marked as static. There is one public constructor and another private constructor.

Thanks for all the responses.
0 Likes
Message 9 of 9

Anonymous
Not applicable

I just told you.

 

In the static constructor of your managed wrapper, load the
DBX.

 

Technically, the managed wrapper for your custom object should
not be

dependent on any ARX (e.g., so it can be used in RealDwg), so
unless

you have incorrectly made your managed wrapper dependent on
your

native ARX/UI component, the managed wrapper should load the
DBX

for your custom object directly, and it should do that from
the static

constructor of the managed wrapper's type.


 

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000
through 2009

href="http://www.acadxtabs.com">http://www.acadxtabs.com

 


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Tony/Owen,
I have the ARX of the custom entity loading the DBX. So, the next logical
question is, how do I load the ARX from my managed wrapper? Also, I looked
into the managed wrapper class header and I don't see the constructor marked
as static. There is one public constructor and another private constructor.
Thanks for all the responses.
0 Likes