Import a DLL at runtime

  • Thread starter Thread starter David Vestal
  • Start date Start date
D

David Vestal

I need to import an unmanaged DLL (not COM or .NET, just a plain DLL), but
there's a caveat. I don't know its name at compile-time.

I know the functions and function signatures that are in it, but I can't
discover the name of the DLL until runtime. DLLImport, unless I'm
mistaken, can only be done at compile-time.

The question is, can I load the library at runtime with pure .NET code?

Thanks.
 
David,

This isn't really possible in the current version of .NET. It might be
possible in the next release of .NET though.

You might want to look into using unmanaged code to expose this kind of
functionality, and then exposing that code to .NET somehow.

Hope this helps.
 
Back
Top