0

Possible Duplicate:
How to convert a dynamic dll to static lib?

Suppose we have a DLL file. Named "dllfile.dll". I want to import it to my C++ project (.exe, console application on Dev-C++) so it is complied with the DLL file itself, then I can publish it without including the .dll file in the same directory with my .exe file. Any suggestions?

Community
  • 1
  • 1

2 Answers2

1

You need a static library for that, you cannot in general use the DLL compiled code for this.

If you have the source code of the DLL, you should be able to compile it as a static library and link to that. This will result in having no dependency on a DLL file for that library.

rubenvb
  • 74,642
  • 33
  • 187
  • 332
0

I can publish it without including the .dll file in the same directory with my .exe file.

In general, you cannot do that.

To do that you would need to decompile dll and turn it into static library, which will be violation of license for freeware, proprietary, GPL and LGPL projects. Linking with contents of dll statically might introduce problems (CRT mixup).

OR you could attempt to obtain static library version of library dll represents, and link statically. This might not be possible for proprietary projects (unless you're willing to pay a lot and THEY're willing to sell), freeware projects, cannot be used for GPL/LGPL dlls (static link => derived work => your project is now GPL/LGPL, which probably isn't what you want).

SigTerm
  • 26,089
  • 6
  • 66
  • 115