3

I'd like to call LoadLibrary() to load a native DLL from an embedded resource. I know how to get the byte[] for the embedded resource, but I do not know how to call LoadLibrary() and GetProcAddress() for a byte[]

Adam Tegen
  • 25,378
  • 33
  • 125
  • 153
  • possible duplicate http://stackoverflow.com/questions/666799/embedding-unmanaged-dll-into-a-managed-c-sharp-dll – Anand Jun 19 '12 at 17:22
  • Maybe this helps you: http://stackoverflow.com/questions/9557293/is-it-possible-to-write-a-jit-compiler-to-native-code-entirely-in-a-managed-n – Felix K. Jun 19 '12 at 17:24

2 Answers2

1

You could look at this tutorial, but as has been previously stated, this is not trivial:

http://www.joachim-bauch.de/tutorials/loading-a-dll-from-memory/

John Koerner
  • 37,428
  • 8
  • 84
  • 134
0

Loading a library from memory is no easy task, and cannot be done with LoadLibray.

Why not save the native DLL to a temporary file and load it from there? You can delete when finished with it or when exiting your application.

Marcel N.
  • 13,726
  • 5
  • 47
  • 72