How do I load a C# dll at runtime?

G

Guest

Hi all

I have been playing around with C# for a while now and can't seem to find any logically named functionality in the .Net framework to load a C# .dll at runtime in the same way you would do it in C/C++ using the Win32 LoadLibrary(...), GetProcAddress(...) and FreeLibrary(...) functions. Perhaps there is some completely different paradigm that I am unaware of to let me do what I want to do

Basically I am creating a application that is going to load a series of .dlls to extend its functionality. Now I understand that this would have to be very different as you can't have global functions in C#........and you don't have header files.........but there has to be some way to load in code from a source that has unknown contents

I would like to proceed doing this in C#, but if there is no way to accomplish this take then I will have to go back to poor old C++.
 
J

Jan Roelof de Pijper

Hi all,

I have been playing around with C# for a while now and can't seem to find any logically named functionality in the .Net framework to load a C# .dll at runtime in the same way you would do it in C/C++ using the Win32 LoadLibrary(...), GetProcAddress(...) and FreeLibrary(...) functions. Perhaps there is some completely different paradigm that I am unaware of to let me do what I want to do.

Basically I am creating a application that is going to load a series of .dlls to extend its functionality. Now I understand that this would have to be very different as you can't have global functions in C#........and you don't have header files.........but there has to be some way to load in code from a source that has unknown contents.

I would like to proceed doing this in C#, but if there is no way to accomplish this take then I will have to go back to poor old C++.

using System.Reflection;
Assembly assembly = Assembly.LoadFrom( strDllName );

Hope this helps!
Jan Roelof
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top