Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. how to load and unload dll or plugin

how to load and unload dll or plugin

Scheduled Pinned Locked Moved Visual Basic
helptutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rattlesnake316
    wrote on last edited by
    #1

    please help me unload my dll and plugin,i have a program that can load a plugin but i dont know how to unload it,they say that my loading should be different so that i can unload it.

    <3:16>

    D O 2 Replies Last reply
    0
    • R rattlesnake316

      please help me unload my dll and plugin,i have a program that can load a plugin but i dont know how to unload it,they say that my loading should be different so that i can unload it.

      <3:16>

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Bascially, if you didn't load the DLL into a new AppDomain, there's no way to unload the DLL.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      R 1 Reply Last reply
      0
      • R rattlesnake316

        please help me unload my dll and plugin,i have a program that can load a plugin but i dont know how to unload it,they say that my loading should be different so that i can unload it.

        <3:16>

        O Offline
        O Offline
        originSH
        wrote on last edited by
        #3

        Theres generally 2 ways of loading plugins, either into the current AppDomain or in to a new AppDomain. The only way to unload an assembly is to unload the entire AppDomain, so if you require unloading of plugins you need a new AppDomain. This doesn't come for free however as serialization has to take place on any objects passing over AppDomain boundries and so incures a performance penalty. If you load into the current AppDomain then things will run at full speed but as you have found you cannot unload the assembly. If your application rarely changes plugins or is often restarted there is very little to gain from using a seperate AppDomain. And so conversly if the app is long running (and so is vunerable to a build up of assemblies) or has a large number of plugin changes then it might be worth taking the hit to allow cleaning up of the assemblies. Personally I wouldn't bother about the unloading unless there is a real need for it ... it would be nice but it's not essential and you can always remove the plugins from use, you just can't remove them from memory. One final note, the seperate AppDomain structure does have one bug advantage when running untrusted plugins. It allows you to place a different set of security restrictions on the code and keep it away from your own code to enhance security and stability. Basically it can be used as a sandbox.

        1 Reply Last reply
        0
        • D Dave Kreskowiak

          Bascially, if you didn't load the DLL into a new AppDomain, there's no way to unload the DLL.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          R Offline
          R Offline
          rattlesnake316
          wrote on last edited by
          #4

          How to load DLL to AppDomain? I really don't have any idea about this,hope you could help me with this,thanks...

          <3:16>

          D 1 Reply Last reply
          0
          • R rattlesnake316

            How to load DLL to AppDomain? I really don't have any idea about this,hope you could help me with this,thanks...

            <3:16>

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            A little Google goes a long way[^]...

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups