Getting Initial DLL reference  
Author Message
Mystagogue





PostPosted: Visual C# Language, Getting Initial DLL reference Top

After using Assembly.LoadFile() to load a DLL, is there any way at all to get an initial reference into it, of any kind (e.g. the ability to call a static method, the ability to make and get an object reference, etc) without using reflection

I only know how to "get going" on a DLL I've loaded, if the first thing I do is a bit of reflection.

On the other hand, perhaps all I'm really looking for, is the C# equivalent of the old "GetProc" used with C++ (which is a reflective kinda thingy, but I'll settle for this if nothing else).




Visual C#9  
 
 
Mattias Sjogren





PostPosted: Visual C# Language, Getting Initial DLL reference Top

No you need to use reflection one way or another. At least you have to get a Type from the assembly that you can instantiate using Activator.CreateIntance. You can then cast it to a well known interface it implements and get strong typing from there on.