Using dlls that are not referenced.
-
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
-
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
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.
-
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
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
-
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
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.
-
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
Thank you! Plug-in was the term I was looking for. Also, thank you for the link, I'm off to some happy coding.