• Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    Tcheko
    Posts: 518 from 2003/2/25
    From: France
    And for going further again, the default start file that is linked at the beginning of the exectuable which is responsible for jumping to the "int main()" entry point and setting up for you some libraries (don't remember the list... sorry) and some more stuff like stdio things does about 10KB.

    You can write your own startup code if you don't need all those fancy things. Krashan published recently a nice example of a custom start file on Morphos-files.net. You can get it here http://morphos-files.net/download/DemoSim

    About 8KB saved. :)

    Beware, if you do your own startup code, you can't use stdio stuff anymore for example! You'll have to use *only* AmigaOS API or stuff that do not rely on I/O from the standard C library (this include printf, sprintf, snprintf etc...).

    Another tip to save some space is using the inline keyword of the C langage. If you're doing some MUI custom class, it is pretty usefull for the dispatcher and can save some more bytes.

    If your MUI API starts to become complex with lot of similar objects kind, avoid the use of the provided macros and write (non inlined!) functions. This will seriously reduce the MUI instanciation code.

    A last step to get some more juice is using a lzma compression: 400KB executable can be shrunk to less than 200KB. Beware, the version string of the executable is lost in the process and need to be appended to the end...

    All in all, if you mix all those things together, you should seriously reduce the size of your binary.
    Quelque soit le chemin que tu prendras dans la vie, sache que tu auras des ampoules aux pieds.
    -------
    I need to practice my Kung Fu.
  • »21.11.15 - 09:04
    Profile Visit Website