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. Using dlls that are not referenced.

Using dlls that are not referenced.

Scheduled Pinned Locked Moved C#
csharpquestion
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.
  • T Offline
    T Offline
    Tim Groven
    wrote on last edited by
    #1

    I'm not even sure if this is possible, or what to even google for, so I'm looking for suggestions. What I want to have is a directory full of .net dlls, that all do different things, but have the same public function as an entry point. I don't want to have to reference each dll, so is there a way to hook up to the dll and use the public function that I know will be the same for each dll file? Thanks, Tim

    M P 2 Replies Last reply
    0
    • T Tim Groven

      I'm not even sure if this is possible, or what to even google for, so I'm looking for suggestions. What I want to have is a directory full of .net dlls, that all do different things, but have the same public function as an entry point. I don't want to have to reference each dll, so is there a way to hook up to the dll and use the public function that I know will be the same for each dll file? Thanks, Tim

      M Offline
      M Offline
      Md Marufuzzaman
      wrote on last edited by
      #2

      Try like the following, <pre>      private const string Kernel32Dll = "kernel32.dll";       private sealed class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid       {          public SafeLibraryHandle() : base(true) { }          [SuppressUnmanagedCodeSecurity]          [DllImport(Kernel32Dll)]          [return: MarshalAs(UnmanagedType.Bool)]          private static extern bool FreeLibrary(IntPtr hModule);          /// <summary>Release library handle</summary>          /// <returns>true if the handle was released</returns>          [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]          protected override bool ReleaseHandle()          {             return FreeLibrary(handle);          }       } </pre>

      Thanks Md. Marufuzzaman


      Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you. I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.

      1 Reply Last reply
      0
      • T Tim Groven

        I'm not even sure if this is possible, or what to even google for, so I'm looking for suggestions. What I want to have is a directory full of .net dlls, that all do different things, but have the same public function as an entry point. I don't want to have to reference each dll, so is there a way to hook up to the dll and use the public function that I know will be the same for each dll file? Thanks, Tim

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        That would be plug-ins or add-ins -- dynamically loaded assemblies. There are several articles on here that deal with that. Here's one that seems pretty good, but there are others.[^]

        modified on Monday, December 7, 2009 1:43 PM

        M T 2 Replies Last reply
        0
        • P PIEBALDconsult

          That would be plug-ins or add-ins -- dynamically loaded assemblies. There are several articles on here that deal with that. Here's one that seems pretty good, but there are others.[^]

          modified on Monday, December 7, 2009 1:43 PM

          M Offline
          M Offline
          Md Marufuzzaman
          wrote on last edited by
          #4

          I agree with you.

          Thanks Md. Marufuzzaman


          Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you. I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.

          1 Reply Last reply
          0
          • P PIEBALDconsult

            That would be plug-ins or add-ins -- dynamically loaded assemblies. There are several articles on here that deal with that. Here's one that seems pretty good, but there are others.[^]

            modified on Monday, December 7, 2009 1:43 PM

            T Offline
            T Offline
            Tim Groven
            wrote on last edited by
            #5

            Thank you! Plug-in was the term I was looking for. Also, thank you for the link, I'm off to some happy coding.

            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