views:

75

answers:

4
+1  Q: 

Two nested DLLs...

Dear all,

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.

Instead, 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

A: 

copy source code from x.dll to a.dll with required functions. or split x.dll to two dll's

yatagarasu
Thanks for your answer, but we have no access to source code of x.dll.
Novice Coder
OP says "We have no access to source code of X.DLL"
TheSean
They don't have the source for X.DLL
CJM
ops sorry )if it is written in any .net language you can stiil disassamble it )
yatagarasu
you can use reflector for this.
yatagarasu
A: 

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.

ULysses
Sorry ULysses, but it certainly isn't "impossible". Ill advised, but not impossible.
torak
it's not impossible it does however requires emitting the byte code your eslf or similar
Rune FS
Depends on the nature of the DLL's. If they're managed code, ILMerge could do the trick. If unmanaged, you'd have to hack around big time with Win32 LoadLibrary.
Pontus Gagge
sure, i didn't pay attention to the c# tag. I was thinking of a windows native dll
ULysses
+3  A: 

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.

VirtualBlackFox
Thanks. I will give it a try.
Novice Coder
+2  A: 

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.

qstarin