Import a DLL at runtime

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.
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

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