.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to tell if a .dll is loaded?

14 REPLIES 14
Reply
Message 1 of 15
Anonymous
3277 Views, 14 Replies

How to tell if a .dll is loaded?

How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
14 REPLIES 14
Message 2 of 15
Anonymous
in reply to: Anonymous

You can set up Acad to load the ObjectARX dll load on demand by modifying
Windows Registry (search this NG for posts on this topic).

Or you can simply use "NETLOAD" command each time you want to use the
command(s) in your dll file, whether the dll has been loaded or not. Say,
you have a command in the dll, called "TheCommand". You can then define a
Lisp command "MyCommand" that calls "NETLOAD" and then "TheCommand", like
this:

(defun C:MyCommand ()
(Command "FILEDIA" "0")
(Command "_.NETLOAD" "C:\\MyFolder\\MyDll.dll" )
(Command "FILEDIA" "1")
(Commad "TheCommand")
)

Place the List command in Acad2xxx.lsp, or startup suite, so that it is
loaded automatically

"T.Willey" wrote in message
news:5355259@discussion.autodesk.com...
How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
Message 3 of 15
Anonymous
in reply to: Anonymous

Thanks Norman. I have seen one post that is directed towards a post in the
VBA group that talks about your first method. I don't really want to mess
with the registry, as I'm not that good yet, so I think I will go the other
route.

--

Tim
"A blind man lets nothing block his vision."


"Norman Yuan" wrote in message
news:5355501@discussion.autodesk.com...
You can set up Acad to load the ObjectARX dll load on demand by modifying
Windows Registry (search this NG for posts on this topic).

Or you can simply use "NETLOAD" command each time you want to use the
command(s) in your dll file, whether the dll has been loaded or not. Say,
you have a command in the dll, called "TheCommand". You can then define a
Lisp command "MyCommand" that calls "NETLOAD" and then "TheCommand", like
this:

(defun C:MyCommand ()
(Command "FILEDIA" "0")
(Command "_.NETLOAD" "C:\\MyFolder\\MyDll.dll" )
(Command "FILEDIA" "1")
(Commad "TheCommand")
)

Place the List command in Acad2xxx.lsp, or startup suite, so that it is
loaded automatically

"T.Willey" wrote in message
news:5355259@discussion.autodesk.com...
How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
Message 4 of 15
Anonymous
in reply to: Anonymous

Assuming your '.DLL' is a managed assembly, you don't
need to do anything 🙂

In .NET, managed assemblies are not actually loaded until
they are required (e.g., you create/use something in them,
like a class or static data).

Hence, if your assembly references another assembly, but
the code in your assembly that uses a class exported by the
referenced assembly never executeds, then the referenced
assembly is never loaded.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"T.Willey" wrote in message news:5355259@discussion.autodesk.com...
How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
Message 5 of 15
Anonymous
in reply to: Anonymous

So if I load it on start-up, but it never gets called, then it never really
got loaded? Is there any way to load a .dll besides the registry way, and
the command 'netload'? I haven't found a way yet.

I would guess my '.dll' is a managed assembly. I don't know enough of the
termology yet.

Thanks Tony.

--

Tim
"A blind man lets nothing block his vision."


"Tony Tanzillo" wrote in message
news:5355704@discussion.autodesk.com...
Assuming your '.DLL' is a managed assembly, you don't
need to do anything 🙂

In .NET, managed assemblies are not actually loaded until
they are required (e.g., you create/use something in them,
like a class or static data).

Hence, if your assembly references another assembly, but
the code in your assembly that uses a class exported by the
referenced assembly never executeds, then the referenced
assembly is never loaded.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"T.Willey" wrote in message
news:5355259@discussion.autodesk.com...
How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
Message 6 of 15
Anonymous
in reply to: Anonymous

I am very much a rookie to dotnet but I have recently been super confused
about this same topic especially after creating a com exposed .net dll.
Tony could probably give a better explanation to what is actually going on
but I stumbled upon another way to load a .net dll without netload or manual
registry changes although the registry is evolved.

I can demand load a com enabled dll into autocad by simply invoking a call
to the com object through vba or lisp. Once you have created the com object
it appears to load itself into autocad. When I built the dll file I had an
option to automatically register it in the registry. Once the dll was
referenced and a tlb was created I was able to call the reference from vba
and use the functions in the dll without ever netloading it into autocad.
I am assuming that (like Tony says) the dll knows how to reference itself to
another assembly which in this case is autocad.


Here is the link to the code that was kindly provided to me that works like
I am trying to describe. The only thing I did different was that I used
sharpdevelop 1.2 and had to manually register the com component and create
the TLB file. With my limited knowledge it is still a little spooky how
this works. It sounds like it works much like Tony was describing below. I
still have no idea how to check the scoop of where and how this is loading
for debugging.
news:5306127@discussion.autodesk.com

Good Luck
--
CB



"T.Willey" wrote in message
news:5355698@discussion.autodesk.com...
So if I load it on start-up, but it never gets called, then it never really
got loaded? Is there any way to load a .dll besides the registry way, and
the command 'netload'? I haven't found a way yet.

I would guess my '.dll' is a managed assembly. I don't know enough of the
termology yet.

Thanks Tony.

--

Tim
"A blind man lets nothing block his vision."


"Tony Tanzillo" wrote in message
news:5355704@discussion.autodesk.com...
Assuming your '.DLL' is a managed assembly, you don't
need to do anything 🙂

In .NET, managed assemblies are not actually loaded until
they are required (e.g., you create/use something in them,
like a class or static data).

Hence, if your assembly references another assembly, but
the code in your assembly that uses a class exported by the
referenced assembly never executeds, then the referenced
assembly is never loaded.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"T.Willey" wrote in message
news:5355259@discussion.autodesk.com...
How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
Message 7 of 15
Anonymous
in reply to: Anonymous

Thanks the imformation, and the link. I will look into this for sure when I
get some time.

--

Tim
"A blind man lets nothing block his vision."


"CB" wrote in message
news:5355806@discussion.autodesk.com...
I am very much a rookie to dotnet but I have recently been super confused
about this same topic especially after creating a com exposed .net dll.
Tony could probably give a better explanation to what is actually going on
but I stumbled upon another way to load a .net dll without netload or manual
registry changes although the registry is evolved.

I can demand load a com enabled dll into autocad by simply invoking a call
to the com object through vba or lisp. Once you have created the com object
it appears to load itself into autocad. When I built the dll file I had an
option to automatically register it in the registry. Once the dll was
referenced and a tlb was created I was able to call the reference from vba
and use the functions in the dll without ever netloading it into autocad.
I am assuming that (like Tony says) the dll knows how to reference itself to
another assembly which in this case is autocad.


Here is the link to the code that was kindly provided to me that works like
I am trying to describe. The only thing I did different was that I used
sharpdevelop 1.2 and had to manually register the com component and create
the TLB file. With my limited knowledge it is still a little spooky how
this works. It sounds like it works much like Tony was describing below. I
still have no idea how to check the scoop of where and how this is loading
for debugging.
news:5306127@discussion.autodesk.com

Good Luck
--
CB



"T.Willey" wrote in message
news:5355698@discussion.autodesk.com...
So if I load it on start-up, but it never gets called, then it never really
got loaded? Is there any way to load a .dll besides the registry way, and
the command 'netload'? I haven't found a way yet.

I would guess my '.dll' is a managed assembly. I don't know enough of the
termology yet.

Thanks Tony.

--

Tim
"A blind man lets nothing block his vision."


"Tony Tanzillo" wrote in message
news:5355704@discussion.autodesk.com...
Assuming your '.DLL' is a managed assembly, you don't
need to do anything 🙂

In .NET, managed assemblies are not actually loaded until
they are required (e.g., you create/use something in them,
like a class or static data).

Hence, if your assembly references another assembly, but
the code in your assembly that uses a class exported by the
referenced assembly never executeds, then the referenced
assembly is never loaded.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"T.Willey" wrote in message
news:5355259@discussion.autodesk.com...
How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
Message 8 of 15
Anonymous
in reply to: Anonymous

No, if you load it on startup, then it's loaded.

If it implements commands, it can be demand-loaded
via the registry. If it implements LISP-callable functions
then it must be explicitly loaded (and there is no other
way to do that from LISP other than NETLOAD, or if the
DLL is a COM server, using vlax-get-interface-object).

What I described earlier is a referenced assembly (e.g.,
an assemtly that you add to your project references),
not the main assembly/DLL that your project compiles
into.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"T.Willey" wrote in message news:5355698@discussion.autodesk.com...
So if I load it on start-up, but it never gets called, then it never really
got loaded? Is there any way to load a .dll besides the registry way, and
the command 'netload'? I haven't found a way yet.

I would guess my '.dll' is a managed assembly. I don't know enough of the
termology yet.

Thanks Tony.

--

Tim
"A blind man lets nothing block his vision."


"Tony Tanzillo" wrote in message
news:5355704@discussion.autodesk.com...
Assuming your '.DLL' is a managed assembly, you don't
need to do anything 🙂

In .NET, managed assemblies are not actually loaded until
they are required (e.g., you create/use something in them,
like a class or static data).

Hence, if your assembly references another assembly, but
the code in your assembly that uses a class exported by the
referenced assembly never executeds, then the referenced
assembly is never loaded.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"T.Willey" wrote in message
news:5355259@discussion.autodesk.com...
How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
Message 9 of 15
Anonymous
in reply to: Anonymous

My preferred approach is to create a ,NET dll project that only contains all
my .NET API commands (i.e. public/public static methods with
[CommandMethod("xxxx")] attribute). This dll references other DLLs that
contain code dothing the actual jobs. So, this dll is very small in size
(less than 50KB, in my case). I load it into Acad at ACAD startup. That
means, all my .NET API commands would be available immediately once Acad
started, but only very small dll file is loaded. All other dlls referenced
by this small dll are only loaded when needed (when a command is called,
which in turn loads referenced dll(s)). This is another form of "load on
demand" without messing registry, as Tony pointed in the other post.

"T.Willey" wrote in message
news:5355585@discussion.autodesk.com...
Thanks Norman. I have seen one post that is directed towards a post in the
VBA group that talks about your first method. I don't really want to mess
with the registry, as I'm not that good yet, so I think I will go the other
route.

--

Tim
"A blind man lets nothing block his vision."


"Norman Yuan" wrote in message
news:5355501@discussion.autodesk.com...
You can set up Acad to load the ObjectARX dll load on demand by modifying
Windows Registry (search this NG for posts on this topic).

Or you can simply use "NETLOAD" command each time you want to use the
command(s) in your dll file, whether the dll has been loaded or not. Say,
you have a command in the dll, called "TheCommand". You can then define a
Lisp command "MyCommand" that calls "NETLOAD" and then "TheCommand", like
this:

(defun C:MyCommand ()
(Command "FILEDIA" "0")
(Command "_.NETLOAD" "C:\\MyFolder\\MyDll.dll" )
(Command "FILEDIA" "1")
(Commad "TheCommand")
)

Place the List command in Acad2xxx.lsp, or startup suite, so that it is
loaded automatically

"T.Willey" wrote in message
news:5355259@discussion.autodesk.com...
How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
Message 10 of 15
Anonymous
in reply to: Anonymous

Thank you Norman.

--

Tim
"A blind man lets nothing block his vision."


"Norman Yuan" wrote in message
news:5356381@discussion.autodesk.com...
My preferred approach is to create a ,NET dll project that only contains all
my .NET API commands (i.e. public/public static methods with
[CommandMethod("xxxx")] attribute). This dll references other DLLs that
contain code dothing the actual jobs. So, this dll is very small in size
(less than 50KB, in my case). I load it into Acad at ACAD startup. That
means, all my .NET API commands would be available immediately once Acad
started, but only very small dll file is loaded. All other dlls referenced
by this small dll are only loaded when needed (when a command is called,
which in turn loads referenced dll(s)). This is another form of "load on
demand" without messing registry, as Tony pointed in the other post.

"T.Willey" wrote in message
news:5355585@discussion.autodesk.com...
Thanks Norman. I have seen one post that is directed towards a post in the
VBA group that talks about your first method. I don't really want to mess
with the registry, as I'm not that good yet, so I think I will go the other
route.

--

Tim
"A blind man lets nothing block his vision."


"Norman Yuan" wrote in message
news:5355501@discussion.autodesk.com...
You can set up Acad to load the ObjectARX dll load on demand by modifying
Windows Registry (search this NG for posts on this topic).

Or you can simply use "NETLOAD" command each time you want to use the
command(s) in your dll file, whether the dll has been loaded or not. Say,
you have a command in the dll, called "TheCommand". You can then define a
Lisp command "MyCommand" that calls "NETLOAD" and then "TheCommand", like
this:

(defun C:MyCommand ()
(Command "FILEDIA" "0")
(Command "_.NETLOAD" "C:\\MyFolder\\MyDll.dll" )
(Command "FILEDIA" "1")
(Commad "TheCommand")
)

Place the List command in Acad2xxx.lsp, or startup suite, so that it is
loaded automatically

"T.Willey" wrote in message
news:5355259@discussion.autodesk.com...
How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
Message 11 of 15
Anonymous
in reply to: Anonymous

Thanks Tony. I think I will have to do some research to better understand
.Net.

--

Tim
"A blind man lets nothing block his vision."


"Tony Tanzillo" wrote in message
news:5355859@discussion.autodesk.com...
No, if you load it on startup, then it's loaded.

If it implements commands, it can be demand-loaded
via the registry. If it implements LISP-callable functions
then it must be explicitly loaded (and there is no other
way to do that from LISP other than NETLOAD, or if the
DLL is a COM server, using vlax-get-interface-object).

What I described earlier is a referenced assembly (e.g.,
an assemtly that you add to your project references),
not the main assembly/DLL that your project compiles
into.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"T.Willey" wrote in message
news:5355698@discussion.autodesk.com...
So if I load it on start-up, but it never gets called, then it never really
got loaded? Is there any way to load a .dll besides the registry way, and
the command 'netload'? I haven't found a way yet.

I would guess my '.dll' is a managed assembly. I don't know enough of the
termology yet.

Thanks Tony.

--

Tim
"A blind man lets nothing block his vision."


"Tony Tanzillo" wrote in message
news:5355704@discussion.autodesk.com...
Assuming your '.DLL' is a managed assembly, you don't
need to do anything 🙂

In .NET, managed assemblies are not actually loaded until
they are required (e.g., you create/use something in them,
like a class or static data).

Hence, if your assembly references another assembly, but
the code in your assembly that uses a class exported by the
referenced assembly never executeds, then the referenced
assembly is never loaded.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"T.Willey" wrote in message
news:5355259@discussion.autodesk.com...
How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
Message 12 of 15
Anonymous
in reply to: Anonymous

The odd thing about the code that I reference is that I do not have to load
the dll into autocad at all. It is not in the registry to autoload. It is
also not being autoloaded by any other means. It is completely not loaded
before the first call to the color dialog box. Once the first call to the
dialog box is made via any com call , I used VBA, then the dll is loaded and
made useable. I have no idea if this is a glitch but it blows my mind as to
how it can do this. It is as if any code that uses the autocad namespace or
managed wrappers is automaticaly loaded and useable by autocad once it is
initialized. Is this true? I can't explain it anyother way. I have not
been taking advantage of this fact in any of my code yet.... as I still do
not understand what is actually taking place that allows this behavior.

For the record I am using the 1.1 framework with acad2006 and compiling the
sample project with sharpdevelop 1.2. After compiling I am using the .net
command line for creating the TLB and registering the com enabled .DLL .
Once that is done... I make sure that my vba code is referencing the correct
TLB. When I run the code, which basically pops up the truecolor dialog box,
everything works. Maybe autocad automatically netloads the referenced dll
after the first call is made through VBA.... I don't know..... but using a
.net dll through VBA seems autoload a dll.
--
CB





"Tony Tanzillo" wrote in message
news:5355859@discussion.autodesk.com...
No, if you load it on startup, then it's loaded.

If it implements commands, it can be demand-loaded
via the registry. If it implements LISP-callable functions
then it must be explicitly loaded (and there is no other
way to do that from LISP other than NETLOAD, or if the
DLL is a COM server, using vlax-get-interface-object).

What I described earlier is a referenced assembly (e.g.,
an assemtly that you add to your project references),
not the main assembly/DLL that your project compiles
into.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"T.Willey" wrote in message
news:5355698@discussion.autodesk.com...
So if I load it on start-up, but it never gets called, then it never really
got loaded? Is there any way to load a .dll besides the registry way, and
the command 'netload'? I haven't found a way yet.

I would guess my '.dll' is a managed assembly. I don't know enough of the
termology yet.

Thanks Tony.

--

Tim
"A blind man lets nothing block his vision."


"Tony Tanzillo" wrote in message
news:5355704@discussion.autodesk.com...
Assuming your '.DLL' is a managed assembly, you don't
need to do anything 🙂

In .NET, managed assemblies are not actually loaded until
they are required (e.g., you create/use something in them,
like a class or static data).

Hence, if your assembly references another assembly, but
the code in your assembly that uses a class exported by the
referenced assembly never executeds, then the referenced
assembly is never loaded.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"T.Willey" wrote in message
news:5355259@discussion.autodesk.com...
How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
Message 13 of 15
Anonymous
in reply to: Anonymous

The .NET runtime manages loading of referenced assemblies,
when they're needed. Since every type contains a reference
to the assembly that contains it, the runtime can find out what
assembly is needed on a type-by-type basis.

If you examine the System.Type class you'll see it has a property
named 'Assembly', which is how the runtime knows what it must
load.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"CB" wrote in message news:5356498@discussion.autodesk.com...
The odd thing about the code that I reference is that I do not have to load
the dll into autocad at all. It is not in the registry to autoload. It is
also not being autoloaded by any other means. It is completely not loaded
before the first call to the color dialog box. Once the first call to the
dialog box is made via any com call , I used VBA, then the dll is loaded and
made useable. I have no idea if this is a glitch but it blows my mind as to
how it can do this. It is as if any code that uses the autocad namespace or
managed wrappers is automaticaly loaded and useable by autocad once it is
initialized. Is this true? I can't explain it anyother way. I have not
been taking advantage of this fact in any of my code yet.... as I still do
not understand what is actually taking place that allows this behavior.

For the record I am using the 1.1 framework with acad2006 and compiling the
sample project with sharpdevelop 1.2. After compiling I am using the .net
command line for creating the TLB and registering the com enabled .DLL .
Once that is done... I make sure that my vba code is referencing the correct
TLB. When I run the code, which basically pops up the truecolor dialog box,
everything works. Maybe autocad automatically netloads the referenced dll
after the first call is made through VBA.... I don't know..... but using a
.net dll through VBA seems autoload a dll.
--
CB





"Tony Tanzillo" wrote in message
news:5355859@discussion.autodesk.com...
No, if you load it on startup, then it's loaded.

If it implements commands, it can be demand-loaded
via the registry. If it implements LISP-callable functions
then it must be explicitly loaded (and there is no other
way to do that from LISP other than NETLOAD, or if the
DLL is a COM server, using vlax-get-interface-object).

What I described earlier is a referenced assembly (e.g.,
an assemtly that you add to your project references),
not the main assembly/DLL that your project compiles
into.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"T.Willey" wrote in message
news:5355698@discussion.autodesk.com...
So if I load it on start-up, but it never gets called, then it never really
got loaded? Is there any way to load a .dll besides the registry way, and
the command 'netload'? I haven't found a way yet.

I would guess my '.dll' is a managed assembly. I don't know enough of the
termology yet.

Thanks Tony.

--

Tim
"A blind man lets nothing block his vision."


"Tony Tanzillo" wrote in message
news:5355704@discussion.autodesk.com...
Assuming your '.DLL' is a managed assembly, you don't
need to do anything 🙂

In .NET, managed assemblies are not actually loaded until
they are required (e.g., you create/use something in them,
like a class or static data).

Hence, if your assembly references another assembly, but
the code in your assembly that uses a class exported by the
referenced assembly never executeds, then the referenced
assembly is never loaded.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"T.Willey" wrote in message
news:5355259@discussion.autodesk.com...
How can you tell if a .dll is loaded into Acad, from Acad? Or does it
matter? I have one routine right now that I want to use, but I only want to
load it when I need it, so I was looking for a way to tell if it's already
loaded, so I don't have to load it again.

Thanks in advance.

--

Tim
"A blind man lets nothing block his vision."
Message 14 of 15
microtecnologo
in reply to: Anonymous

Hi T. Willey! This is Fernando from Mexico, today I have faced with the same nececity to know

wether a dll loaded through Netload command has been loaded or not. The main trouble is

that my dll loses its functionality after being loaded once before. I have been working the entire

day looking for a solution, and fortunatly I got it. Are you still there? After a 12 years? 

    Best Regards

    Fernando

Message 15 of 15
SENL1362
in reply to: microtecnologo

It may be difficult to know what DLL is (net)loaded although if you store classes in separated files you can determine if the class is available.

However another approach is to check if the DLL is locked, because when it is, it is almost certainly loaded.

Search for (Files) LockFinder:
//https://code.msdn.microsoft.com/windowsapps/How-to-know-the-process-704839f4/sourcecode?fileId=14958...

...
var dllPathname=@"...dll"; var processes = LockFinder.FindLock.GetLockingProcessByFile(dllPathname); if (processes != null) { ed.WriteMessage($"Process Locking {dllPathname}:"); foreach (var process in processes.OrderBy(n => n.ProcessName)) ed.WriteMessage($"\t{process.ProcessName}"); }
...

When my DLL is loaded it appears to be locked by ACAD+MSVSMON.

 

For Locked Folders search for:

WinKernelObjects..GetLockingProcessByDirectory(path)

 

 

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost