Notifications
Clear all

[Closed] Unload .Dll , using as a plugin?

Hey,

I know this has been discussed before, but I came across this site.

http://scorp007.comze.com/

Would it be possible to load in a custom .dll in a plugin, then use his script to unload it, so that we could make changes to a .DLL without closing/re-opening max?

Thanks!

14 Replies
 lo1

A coworker of mine tried it with a controller plugin he was developing, and while it successfully unloaded the dll, that did not help much, as 3dsmax would crash immediately after. Perhaps you will have better luck with a different type plugin.

A different type of solution is to add a pre-build action that kills the 3dsmax process and a post-build action that relaunches it.

Yeah… Damn. The kill/launch idea would help too I suppose. Thanks

i’m 100 % sure that we are talking about .net/c# dll.
it can’t be unloaded with the utility that you point to.

the way that i do the .net/c# dll debugging is the using of dynamically loaded dll. it allows you to recompile the dll without reloading the system:
the original idea by Gravey
http://forums.cgsociety.org/showpost.php?p=6404020&postcount=468
my version:
http://forums.cgsociety.org/showpost.php?p=6864094&postcount=480

if its c++…

  • test your plugin
  • save scene
  • reset max
  • unload plugin
  • change code/compile
  • reload plugin
  • load test-scene

if you have something in your scene which is using your plugin, max will crash after unload cuz the code is gone
didn’t try it, but should do

guruware

Hey,

So Dennis, when you said,

it creates new assembly the same way as in your code.
And of course we have to use CreateInstance assembly method to create
classes from newly created assembly. MAX dontenobject and dotnetclass
methods create object(class) using first loaded assembly.

Did you mean that I should load my dotNetObject first, then the other Dlls I might use? I tried loading all 3 of my Dlls with your method, and it fails on this custom Multi-selection TreeView I have. This is the error I get.



---------------------------
MAXScript MacroScript 
Error Exception
---------------------------
-- Runtime error: dotNet 
runtime exception: Could not load file or assembly 'TreeViewMS, 
Version=1.0.960.12060, Culture=neutral, PublicKeyToken=null' or one of its 
dependencies. The system cannot find the file specified.


i don’t know what your dlls do… technically they might need specific loading order. Can you load them using dotnet.loadAssembly method?

They work fine if I load them with the dotnet.loadassembly . Its when I tried to use your other method, I got that error. i tried switching around orders and it didn’t seem to work, but I’m going to try it again once.

I don’t need my FreeImage or TreeviewMS DLLs to load in dynamically, only my main one.

So technically, I should be able to over-write my custom DLL then and it should work otherwise, correct?

and is any way to UnLoad .net dll and free used memory? just to ask tho

Well, I think that happens when you use his method he said.

Since it’s loading the dll into the reflection or whatever in realtime, I would assume max garbage collects it when you close your UI or whatever was using the code to start with.

I need to mess around with this more yet and see if I can get it working. I really really hate having to restart max everytime. But it’s not as bad at home as here at work. It takes like 2x as long to restart max than at home.

Page 1 / 2