Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I embed a win32 DLL in a .NET assembly, and make calls into it using P/Invoke?

Tags:

I'm writing a C# wrapper for a third-party native library, which we have as a DLL. I would like to be able to distribute a single DLL for the new assembly. Is it possible for me to embed the win32 DLL in my .NET DLL, and still make calls into it using P/Invoke? If so, how?

like image 424
Simon Avatar asked Dec 15 '08 11:12

Simon


1 Answers

I've never done it but I know of an opensource project that does this. They embed the native SQLite3 code into the managed SQLite assembly using their own tool called mergebin.

Go and take a look at the SQLite project for .NET by PHX and grab the source and you can see how it's done.

like image 172
Kev Avatar answered Sep 30 '22 19:09

Kev