We have a dll file; let's say X.DLL.
We are now writing another DLL, let's say "A.DLL" that uses some (very few) of the functions of X.DLL. We have no access to source code of X.DLL. Also, we don't want to give our clients X.DLL along with A.DLL.
Inste开发者_运维知识库ad, we want to encapsulate X.DLL within A.DLL, so that distributing A.DLL will suffice.
Is it something possible?
Your help is appreciated.
Novice Coder
ILMerge
ILMerge is a utility for merging multiple .NET assemblies into a single .NET assembly. It works on executables and DLLs alike and comes with several options for controlling the processing and format of the output. See the accompanying documentation for details.
You tagged your question with c#.
If these are managed assembly DLL's, which they will be if the code is c#, then you can do exactly what you want with ILMerge.
copy source code from x.dll to a.dll with required functions. or split x.dll to two dll's
It is impossible to encapsulate one dll into another.
A way out may be if you can obtain a lib from the X.DLL vendors, and statically link to it with your code.
A hack out may be carrying the X.DLL as a resource inside you dll, then unpack and load in in the runtime.
精彩评论