Question Embedding Unmanaged Libraries

sebeka

New member
Joined
May 22, 2009
Messages
4
Programming Experience
5-10
Hi,

I have an unmanaged DLL written in C++ and imported into my .NET application via <DLLImport()> that I use to interface with a custom dos device driver. However, I'd like to either access the device directly or embed the DLL in my .NET application.

I've tried using Reflection.Assembly (see code below) to gain access to the embedded DLL, however, because it's unmanaged and there is no class to instantiate (CreateInstance fails), I cannot access it that way.

Does anyone know of a way to embed this in my application and access it via reflection or some other means?

Thanks. -S

VB.NET:
Dim asmbly As Reflection.Assembly = Reflection.Assembly.Load(My.Resources.UnmanagedDLL)
 
Assembly.Load is only for loading assemblies, i.e. managed libraries. Unmanaged libraries must either be in the same folder as your assembly or in the system folder.
 
Assembly.Load is only for loading assemblies, i.e. managed libraries. Unmanaged libraries must either be in the same folder as your assembly or in the system folder.

That sucks, I was hoping someone might have a work-around. I was able to forgo the DLL altogether and interface with the device directly from VB.NET via API calls.
 
Back
Top