Home > Blockchain >  How to embed a DLL into a DLL?
How to embed a DLL into a DLL?

Time:12-15

I managed to create a program in C / Visual Studio 2010, 2017. And now I have to embed a DLL (B.dll) inside of another DLL (A.dll).

I succeed in executing another program (C.exe) that uses A.dll. But I don't know how to embed a DLL into a DLL.

Is it possible ? If it is possible, what should I do?

I have solutions for A.dll, B.dll, C.exe.

image

CodePudding user response:

If you mean linking by 'embed', You can use the same .lib file for your B.dll to link with A.dll as you did with C.exe.

CodePudding user response:

If you truly want to embed B.dll inside of A.dll, you can define B.dll as a resource of A.dll via an .rc script in A.dll's project. Then you can use B.dll at runtime by first using (Find|Load|Lock)Resource() to access the bytes for B.dll's resource and writing them to a tempory file using (Create|Write)File() before then loading that file with LoadLibrary().

  • Related