How to load an unmanaged DLL from a stream?

I have an application written in .NET 4.0 that needs to load a native DLL (written in C) into memory.

I am currently using the P / Invoke call for LoadLibrary, passing the path where the DLL is located.

This works, but due to the fact that this DLL comes from the database, I would like to know whether it is possible to load it through the stream, while avoiding the need to store the DLL somewhere in the file system.

+3
source share
2 answers

Windows does not allow this; internal code must always be loaded from a file on disk. This is the core to a way to develop an operating system, executable files are mapped to memory through a memory mapped file. This requires a file.

(Assembly.Load(byte []) , IL - , .

DLL dbase, , UAC, - , . -, .

+2

, PInvoke. PInvoke , .

, LoadLibrary GetProcAddress , dll.

PInvoke.

0

All Articles