We have been asked about the ability of our application virtualization solutions to bundle numerous dynamic link library (dll) files for Qt programs (http://qt.nokia.com/) compiled for Windows and in this post I will show how to bundle/merge Qt runtime libraries to the single executable.
Application Virtualization in this context means emulation of files (and registry) in memory, without having the files on the disk (and registry items in real registry).
What are benefits of application virtualization?
1. Distribute your program as a single, stand-alone executable, or as a portable application. All virtual files are being added to the main executable, so there is no need to have these files on the disk.
2. Compress virtual files. In the example below we will virtualize 2 Qt runtime dll – QtCore4.dll and QtQui4.dll. Size of these two dll files is about 12.4 Mbytes + 0.1 MBytes of main executable, after virtualization, size of the bundled executable is being decreased up to 5.5 MBytes, that gives us 55% compression ratio!
3. We can be sure that only our virtual runtime libraries will be loaded. Imagine you distribute your Qt application, compiled for Windows, to customers. Customer’s system may already have Qt runtime libraries installed, but the version of installed files differ from the one your application requires, let’s say your application requires the latest versions of runtime, but installed older. If the older runtime files will be located in Windows directory but your new one in the folder with exe file, the system will be trying to use files located in Windows directory, i.e. older files. Using older files may be impossible for your application that will cause refusing of execution.
If Qt runtime libraries are virtualized and even if the system already contains any Qt runtime, the virtualized one will be applied to your application anyway.
4. Make sure virtual files are not modified. Since virtual files are not stored on the disk, it is quite difficult to change/patch them.
5. Virtualize any other files from your application! Virtualization ability is not limited by bundling only runtime libraries, it supports any other kind of files: images, video, music, data files and any other.
How to do?
Enigma Virtual Box (freeware)
- Download Enigma Virtual Box from http://enigmaprotector.com/en/downloads.html install it and run
- Select the input file – main executable of the compiled Qt program (output file name will be assigned automatically)
- Add Qt runtime libraries to the files list, in the %DEFAULT FOLDER% (QtCore4.dll and QtQui4.dll)
- Enable compression options for files
- Click Process button
Now test output file. It will be working well even if we delete QtCore4.dll and QtQui4.dll from the disk.
- Download Enigma Protector from http://enigmaprotector.com/en/downloads.html install it and run
- Go to Input panel (from the left side navigation menu) and select the input file – main executable of the compiled Qt program (output file name will be assigned automatically)
- Go to Virtual Box – Files panel, enable files virtualization feature and add Qt runtime libraries to the files list, in the %DEFAULT FOLDER% (QtCore4.dll and QtQui4.dll)
- Enable compression options
- Click Protect button
Please note, the Enigma Protector allows same virtualization functionality as Enigma Virtual Box, but also offers many features to protect your software, protect virtual files, add licensing features and so on.