alternative to ilmerge but for c++?

  • Hi all. i'm searchin some way to embed my dll's like embedded resource in c++ like ianyone can do in other languages like net . The problem is that my program/project require some dependencies (they are in native) and need to put them like embedded resource just simple. I read some projects in github that they said is possible but still i didnt get any advance.
    Someone knows how i can do this task to add my dependecies like embedded resource?
    Can not be static library because they are just objects and can not works like resources? My libraries (dll's) are in c++ and the project/program is in c++ too.

  • Lifetime Qt Champion

    @RIVOPICO said in alternative to ilmerge but for c++?:

    Someone knows how i can do this task to add my dependecies like embedded resource?

    That is, as you already stated, indeed called static linking in C++. For the Qt libraries, the procedure is described here:

    Please note that this will require a commercial Qt licence, as the (L)GPL requires that your users can exchange these libraries.

  • @aha_1980 i need like embedded resource not static linking. i mean linked objects in my case is not the purpose. it's just embedded resource. and it's not impossible

  • Moderators

    There are multiple options depending on which particular technology you use.
    Some examples include:
    If you're using Qt: Qt Resource System
    If you're using MSVC: Resource files
    If you're using wxWidgets: XRC
    If you're using CMake: embed-resource

    There are probably many more. Just do a search containing words c++, resource and your favorite library or compiler or framework and you'll get many results to choose from.

  • Lifetime Qt Champion

    So once the DLLS are compiled into the exe.
    What do you plan to do with them?
    Its not runnable when embedded resource so i wonder what
    use they can have ?

  • This post is deleted!

  • @mrjj it's just because i was searching some alternative to ilmerge but for c++. but i think the only way actually is doing it manually.

  • @mrjj and yes it's very useful because i remeber that in the old times when i tried to make a static compilation with qt took my longtime (make the compiler static) . and if you check how much time you need to use ilmerge, 3 minuts.
    but obviously this is only for net and maybe the people just dont need to compile again to add your static libraries if you have the dll merging them must to be enough.

  • @RIVOPICO could you please state your requirements? From what I understand so far, it looks like you're trying to do something in Qt/C++ which applies only to .Net. From [ilmerge documentation](link url):

    ILMerge takes a set of input assemblies and merges them into one target assembly. The first assembly in the list of input assemblies is the primary assembly. When the primary assembly is an executable, then the target assembly is created as an executable with the same entry point as the primary assembly.

    So for me, the equivalent to such action in Qt/C++ is static linking as @aha_1980 already pointed out.

    But if you still need imperiously your .DLLs as "embedded resources" you could freely add such files to a Qt resource (.qrc) which will end up embedded in your resulting .exe like icons or translation files are used for instance. However, I'm not sure you'll be able to use the DLLs via the resource path i.e. ":/path/to/myDLL". At any time, given the DLLs are not required at the very beginning of your application, you could still save the contents of the resource into actual files.

    All in all, it looks like you're trying to do something that's not usual in Qt/C++ and the cost/benefit isn't clear for me as I may be missing your actual intent/requirement.

  • @Pablo-J.-Rogina i just say that if it exist some alternative to ilmergue but for c++ will make the life more easy to the developers. jus that i am not talking abouyt money i know static linking and how much effor you need to make static linking configurating msvc or visual studio or mingw (the compiler) to do the static linking correctly and this could be just solved in few step's if it would exist one alternative to ilmergue but for c++. In net , the most used language in the majority is because just if you have dependencies in question of seconds you solve this problem. this in c++ doesnt happen. sorry for my late answer.

  • Lifetime Qt Champion

    For a tool to work like ilmerge for c++, it would have to have static Qt for any platform supported. Huge amount of work so its not likely it will ever happen.

Log in to reply