How to combine unmanaged dll and managed assembly into one file?

SQLite from PHX Software combined the managed assembly (System.Data.SQLite) with the unmanaged dll (SQLite 32- or 64-bit dll) into one file and managed to link them together.

How can I do it? Do i need to embed a managed assembly in an unmanaged dll or vice versa?

T. My questions:

  • In what order do I need to do this?
  • What tools or knowledge do I need for this?
  • How (if different) is a link to exported functions from an unmanaged dll in managed code?

The reason I'm asking is because I want to create a managed zLib wrapper. I know that there are managed classes in .NET, but because of their experience, they are a bit limited (and a little saddened that they do not properly buffer), so I would like to create my own copy, also because I want to find out , how to do it.

So does anyone know what I need to do and how?

I found the following:

I am going to try this, but any additional information would also be nice.

+7
dll managed embed assemblies unmanaged
source share
2 answers

Have you tried running the reflector on System.Data.SQLite to find out how they do it?

I would suggest that you could:

  • Include 32-bit and 64-bit DLLs as resources in a managed assembly.
  • Extract the correct value depending on the bitness somewhere
  • Call SetDllDirectory () via PInvoke if necessary so that windows can find the extracted dll
  • Create an instance of a 32-bit managed shell class that has DLL references

However, because zlib is in C, you can also wrap the calls you need in C ++ implemented in the CLR assembly using the zlib source. But I'm not sure how you will deal with bitness in this case.

0
source share

find mergebin from sqlite , this should be what you are looking for.

It can combine both managed and unmanaged assemblies.

MS also seems to have something to say about using here

0
source share

All Articles