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. C#
  4. dll library loading

dll library loading

Scheduled Pinned Locked Moved C#
csharpvisual-studioquestion
4 Posts 4 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.
  • B Offline
    B Offline
    Blubbo
    wrote on last edited by
    #1

    There may be some instances that I would load the dll library. One time that I might be using this abc.dll then later in time that I would have the application to change to different dll which would be xyz.dll. Basically that they have the methods but have very different algorithms inside there. What's the best way for me to do that? Right now that I'm using this: Assembly a = Assembly.LoadFrom("abc.dll"); Type mm = a.GetType("abc"); object o = Activator.CreateInstance(mm); object[] par = new object[] { }; ds_LUT = (DataSet)(mm.InvokeMember("GetLutTable", BindingFlags.Default | BindingFlags.InvokeMethod, null, o, par)); Is there a way to keep the dll open until I am "finished" with it so I can close it and open the other dll? That will be done during runtime. Additional note: The dll are in c# language and was created in Visual Studio.Net 2005 software.

    S P L 3 Replies Last reply
    0
    • B Blubbo

      There may be some instances that I would load the dll library. One time that I might be using this abc.dll then later in time that I would have the application to change to different dll which would be xyz.dll. Basically that they have the methods but have very different algorithms inside there. What's the best way for me to do that? Right now that I'm using this: Assembly a = Assembly.LoadFrom("abc.dll"); Type mm = a.GetType("abc"); object o = Activator.CreateInstance(mm); object[] par = new object[] { }; ds_LUT = (DataSet)(mm.InvokeMember("GetLutTable", BindingFlags.Default | BindingFlags.InvokeMethod, null, o, par)); Is there a way to keep the dll open until I am "finished" with it so I can close it and open the other dll? That will be done during runtime. Additional note: The dll are in c# language and was created in Visual Studio.Net 2005 software.

      S Offline
      S Offline
      Scott Dorman
      wrote on last edited by
      #2

      Without getting into additional app domains, once the DLL is loaded you will not be able to unload it. You can load more than one DLL at a time, so the idea of needing to "close it and open the other dll" doesn't really apply.

      Scott.


      —In just two days, tomorrow will be yesterday. [Forum Guidelines] [Articles] [Blog]

      1 Reply Last reply
      0
      • B Blubbo

        There may be some instances that I would load the dll library. One time that I might be using this abc.dll then later in time that I would have the application to change to different dll which would be xyz.dll. Basically that they have the methods but have very different algorithms inside there. What's the best way for me to do that? Right now that I'm using this: Assembly a = Assembly.LoadFrom("abc.dll"); Type mm = a.GetType("abc"); object o = Activator.CreateInstance(mm); object[] par = new object[] { }; ds_LUT = (DataSet)(mm.InvokeMember("GetLutTable", BindingFlags.Default | BindingFlags.InvokeMethod, null, o, par)); Is there a way to keep the dll open until I am "finished" with it so I can close it and open the other dll? That will be done during runtime. Additional note: The dll are in c# language and was created in Visual Studio.Net 2005 software.

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        The only way to do this would be to have the DLL loaded into a separate AppDomain, which you could then unload. Mind you, I don't see what benefit this would bring you, as the Type would be completely different when you load up the new DLL - even if they have the same name, they really are different types so you won't have to worry about implementation collisions.

        Deja View - the feeling that you've seen this post before.

        1 Reply Last reply
        0
        • B Blubbo

          There may be some instances that I would load the dll library. One time that I might be using this abc.dll then later in time that I would have the application to change to different dll which would be xyz.dll. Basically that they have the methods but have very different algorithms inside there. What's the best way for me to do that? Right now that I'm using this: Assembly a = Assembly.LoadFrom("abc.dll"); Type mm = a.GetType("abc"); object o = Activator.CreateInstance(mm); object[] par = new object[] { }; ds_LUT = (DataSet)(mm.InvokeMember("GetLutTable", BindingFlags.Default | BindingFlags.InvokeMethod, null, o, par)); Is there a way to keep the dll open until I am "finished" with it so I can close it and open the other dll? That will be done during runtime. Additional note: The dll are in c# language and was created in Visual Studio.Net 2005 software.

          L Offline
          L Offline
          Larantz
          wrote on last edited by
          #4

          How about letting the types within the assemblies inherit a given interface? Then cast the instances to the interface on creation and the methods will be the same, but the implementation in the various types will differ. -Larantz-

          for those about to code, we salute you
          http://www.itverket.no

          Please refer to the Forum Guidelines for appropriate posting.

          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