Combine DLLs into one

Discussion in 'Code Samples & Tips' started by dzt, Nov 24, 2007.

  1. dzt

    dzt Active Member Licensed User

    Hi,

    Yes, you can combine various b4ppc libraries (official or not) into one.
    How? Read below.

    Download from here MSDN Code Gallery illink.zip and extract it to a folder, lets say c:\illink

    Download also .NET 1.1 or NET 2.0 (for ilasm.exe) and .NET 1.1 SDK or NET 2.0 SDK (for ildasm.exe) from Microsoft. Install them.

    Add to your path the folder of ilasm.exe and the folder of ildasm.exe.

    Now you are ready!

    Lets say, you have three DLLs. dll1.dll, dll2.dll and dll3.dll and you want to combine them all to MyDLL.DLL. Run the following from the command prompt.

    c:\illink\illink.exe dll1.dll dll2.dll dll3.dll /out=MyDLL.DLL

    MyDLL.DLL now includes all the functionality of the three DLLs.

    Edit:
    illink.zip attached because GotDotNet site has been shut down.
     

    Attached Files:

    Last edited: May 20, 2008
  2. Erel

    Erel Administrator Staff Member Licensed User

    Great tip :sign0188:
    Notice that it will not work with the SQL library (because it contains native code).
     
  3. agraham

    agraham Expert Licensed User

    Excellent find dzt! Thank you.
     
  4. alfcen

    alfcen Well-Known Member Licensed User

    Hi Dimitris,
    I am speechless... always wanted to minimize the number of files underneath my application directories.
    Thanks so much for sharing this valuable information.
    Cheers
    Robert
     
  5. alfcen

    alfcen Well-Known Member Licensed User

    Hi Dimitris
    illink.exe claims it can't find msvcr70d.dll.
    Before I download hundreds of megabytes of SDK's I thought it was a better idea to ask :)
    No hurry
    Cheers
    Robert
     
  6. Erel

    Erel Administrator Staff Member Licensed User

  7. alfcen

    alfcen Well-Known Member Licensed User

    Thank you, Erel,
    I downloaded .NET 1.1 SDK. I will now try with the
    .NET Framework 2.0 Software Development Kit (SDK) (x86)
     
  8. DeeCee

    DeeCee Member Licensed User

  9. alfcen

    alfcen Well-Known Member Licensed User

    Hi Louis,
    Thanks a lot for your utility!
    I have reworked the GUI and added some functions to catch up errors.
    Still, it won't work without that msvcr70d.dll.
     

    Attached Files:

  10. alfcen

    alfcen Well-Known Member Licensed User

    Hi Erel,
    Downloading the SDK 2.0 did not bring the msvcr70d.dll with it.
    I have both frameworks, 1.1 and 2.0 installed on the desktop.
    According to Microsoft, this library may not be redistributed.
    Resonable to assume that it is part of a commercial package.
    Question remaining, which package?
     
  11. Louis

    Louis Active Member Licensed User

  12. alfcen

    alfcen Well-Known Member Licensed User

    Hi, thanks so much Louis, the MSVCR70d.dll error is out of the way :)
    However, it does not combine. I tried at the DOS prompt:

    C:\gui\illink.exe C:\gui\Bitwise.dll C:\gui\Hardware.dll /out=C:\gui\henshu.dll

    Result:
    Failed to open intermediate input file. Possible failure disassembling C. Specified file not found.
     
  13. Louis

    Louis Active Member Licensed User

    You know, that happens to me too, not sure what to do.
     
  14. dzt

    dzt Active Member Licensed User

    Hi,

    Make sure the folder containing ilasm.exe is in your path. ilasm is not part of the SDKs but it is included in normal .NET installation.

    If it is not included (in your path) then include it, or try copying it to c:\gui
     
  15. alfcen

    alfcen Well-Known Member Licensed User

    Haisai Dimitris,

    Thanks a lot for the 'cavallery' :)

    I copied both, ilasm.exe and oldasm.exe, including their config files into the gui folder and run illink.bat in C:\gui\

    Sorry, but no better results.

    I uploaded the complete gui folder to
    http://www.alfcen.net/gui.zip (530KB)

    If it is not too much trouble, could you please compare it with your configuration? No hurry :)

    Thanks
    Robert
     
  16. agraham

    agraham Expert Licensed User

    I like this one as it is a standalone app with no other dependencies (than .NET 2.0). Thanks DeeCee.
     
  17. dzt

    dzt Active Member Licensed User

    Hi all,

    DeeCee is right (agraham too)

    ILMerge works fine for me (illink too) and it seems it has not other dependencies.

    Thank you DeeCee and agraham.

    Haisai Robert,

    I downloaded your gui folder and works fine here, but I'm stopping researching further as ILMerge will do the job easier.
    Please let me know if everyone wants to continue.
     
  18. alfcen

    alfcen Well-Known Member Licensed User

    Just downloaded ilMerge, and I join you :)

    In DOS, I used

    Version 1.1
    C:>ilmerge1>ilmerge /keyfile:registrydesktop.dll hardwaredesktop.dll /out:myappdesktop.dll

    Version 2.0
    C:>ilmerge2>ilmerge /keyfile:registrydesktop.dll hardwaredesktop.dll /out:myappdesktop.dll

    Both create myappdesktop.dll with the right size, but can't be loaded into the IDE, claiming (in Japanese) it can't open the assembly public key.

    I had to add mscorsn.dll to get it that far.

    Anything wrong with my batch?

    Since my gui folder worked for dzt, but not for me, one could assume that something is missing or incorrect in my system. Both frameworks, 1.1 and 2.0 are installed.

    Haisai Dimitris
    Thanks a lot for testing!
     
  19. dzt

    dzt Active Member Licensed User

    Hais... No No Hi Robert (please I need more Japaneese words:)),

    Well this works fine for me.

    ilmerge registrydesktop.dll hardwaredesktop.dll /out:myappdesktop.dll
     
  20. alfcen

    alfcen Well-Known Member Licensed User

    Konnichi wa (Good Day), Dimitris

    Sassoku kakunin shite itadaki, domo arigatou gozaimazu (thanks very much for your prompt confirmation).

    Boku no pasokon no settei wa okashi kamo shiremasen, ne (well, obviously something is wrong with my desktop settings).

    Kore kara mo ganbaru zo (I will try hard to fix that).

    Mata taifu ga okinawa ni chikazuite imasu (again, a typhoon is approaching Okinawa).

    Yoroshiku (cheers)

    PS: you wrote you needed more Japanese words :sign0151:
     
Loading...