Using DLL's without knowing the dll name at compile-time. (original) (raw)
Greetings. I want to call code contained in an unmanaged DLL. Normally, I understand, you'd create a prototype something like:
[DllImport("user32.dll", CharSet=CharSet.Auto)] public static extern int MessageBox(int hWnd, String text, String caption, uint type);
And then use MessageBox() as if it's a managed function. However, in my case, I don't know the name of the DLL at compile time. How do I handle that?
The idea is that you'll be able to dynamically add DLL's to the system. These DLL's will have a common function that's used to run whatever code they contain...
Any and all suggestions would be greatly appreciated.