Archived Forum Post

Index of archived forum posts


Chilkat HTTP Executable Too Large

Jun 09 '16 at 21:22

I'm using the C++ HTTP lib with WinCE 6.0 on an embedded payment terminal. Linking in the Chilkat lib has increased the size of both the Release and Debug versions of the resulting executables (makes sense). While both have doubled in size, my problem is with the Debug executable - it is now over 5 Megs in size which is too large to load onto the target device (according to VS). I'm only using the CkHttp and CkHttpResponse classes, is there any way to cut down the size of the .exe?


Accepted Answer

I answered my own question - there is a way to curb the bloat. The following will stop the linker from linking-in unused and/or duplicate code:

In my case these changes caused the size of the Debug executable to drop from 5.2 Megs to 3.3 Megs.


When a program is linked with a static library, the linker only includes the library code that is directly or indirectly referenced. This is true regardless of the operating system and regardless of the compiler/linker (gcc, vc++, QT, etc.)

Therefore, it's not possible to cut down on the size. Implementing HTTP/HTTPS touches upon most everything in the underlying infrastructure: encryption, hashing, public-key algorithms, MIME, TLS, TCP, the HTTP protocol itself, proxies, tunneling, authentication, character encoding, etc. The only reason the given functionality is available on older platforms (and cross-language/cross-platform) is because Chilkat implements it all directly -- and this adds to the size. If Chilkat didn't then the features and reliability/sameness of Chilkat's behavior cross-platform would not be possible (and Chilkat certainly wouldn't be possible on WinCE 6.0).