How do I combine an unmanaged dll and a managed assembly into one file?

戏子无情 提交于 2019-12-05 04:16:09

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

I'd imagine you could:

  • Include the 32 and 64 bit dlls as resources in a managed assembly
  • Extract the correct one depending on bitness to somewhere
  • Call SetDllDirectory() via PInvoke if necessary so that windows can find the extracted dll
  • Instantiate a 32 or 64 bit managed wrapper class which has references to the dll

However because zlib is in C you could also wrap the calls you need in a C++ implemented CLR assembly using the zlib source. But I'm not sure how you would handle bitness in that case.

look up mergebin from sqlite it should be what you are looking for.

it can merge both managed and unmanaged assemblies togeteher .

MS also seems to have somthing to say about using it here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!