Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. DLL size

DLL size

Scheduled Pinned Locked Moved C / C++ / MFC
c++jsonquestion
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PatrykDabrowski
    wrote on last edited by
    #1

    I have a simple DLL project created in VS2003. I don't use MFC, just plain Windows API. I call only FindWindowEx(), SetWindowsHookEx(), UnhookWindowsHookEx(), SendMessage(), PostMessage() and CallNextHookEx(). I export only two of four functions and use only four global variables. Why my relese DLL is ~50kb?? Is VS2003 adding soe other resources? I have seen some DLL's smaller than mine (10-20kb) - how is it possible?? Well, I actualy don't care about the size of this DLL, I'm just curious what makes it so 'big'??

    M R D J 4 Replies Last reply
    0
    • P PatrykDabrowski

      I have a simple DLL project created in VS2003. I don't use MFC, just plain Windows API. I call only FindWindowEx(), SetWindowsHookEx(), UnhookWindowsHookEx(), SendMessage(), PostMessage() and CallNextHookEx(). I export only two of four functions and use only four global variables. Why my relese DLL is ~50kb?? Is VS2003 adding soe other resources? I have seen some DLL's smaller than mine (10-20kb) - how is it possible?? Well, I actualy don't care about the size of this DLL, I'm just curious what makes it so 'big'??

      M Offline
      M Offline
      mark novak
      wrote on last edited by
      #2

      This fascinates most programmers. Your size depends a lot on the compile settings you have. Are you statically linking into ATL? Is it a debug version? Do you have it optimized for speed or size? Are you using exception handling? All these things take up space, personally I think you've linked into the C runtime library statically, so you have /MD Multi-threaded. If you select /MD you'll link dynamically and won't have to have a copy of strcpy and what not in your application. Some people have been known to make their application really small by not using the C runtime and writing or calling the Windows equivalent of all the C runtime functions. Hope this helps, Mark

      P 1 Reply Last reply
      0
      • M mark novak

        This fascinates most programmers. Your size depends a lot on the compile settings you have. Are you statically linking into ATL? Is it a debug version? Do you have it optimized for speed or size? Are you using exception handling? All these things take up space, personally I think you've linked into the C runtime library statically, so you have /MD Multi-threaded. If you select /MD you'll link dynamically and won't have to have a copy of strcpy and what not in your application. Some people have been known to make their application really small by not using the C runtime and writing or calling the Windows equivalent of all the C runtime functions. Hope this helps, Mark

        P Offline
        P Offline
        PatrykDabrowski
        wrote on last edited by
        #3

        I'm not using ATL/MFC. I compile with default "Release" settings for the Win32|DLL project template. When I remove ALL my functions and variables (just plain DllMain(){return TRUE;}) I get ~45kb DLL... Maybe that's this /MD switch... I will try to play with this. Thanks for suggestion.

        1 Reply Last reply
        0
        • P PatrykDabrowski

          I have a simple DLL project created in VS2003. I don't use MFC, just plain Windows API. I call only FindWindowEx(), SetWindowsHookEx(), UnhookWindowsHookEx(), SendMessage(), PostMessage() and CallNextHookEx(). I export only two of four functions and use only four global variables. Why my relese DLL is ~50kb?? Is VS2003 adding soe other resources? I have seen some DLL's smaller than mine (10-20kb) - how is it possible?? Well, I actualy don't care about the size of this DLL, I'm just curious what makes it so 'big'??

          R Offline
          R Offline
          realJSOP
          wrote on last edited by
          #4

          "Big"? 50k is pretty good, IMHO. Change your release mode optimization from "optimize for speed" to "optimize for size".

          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
          -----
          "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

          1 Reply Last reply
          0
          • P PatrykDabrowski

            I have a simple DLL project created in VS2003. I don't use MFC, just plain Windows API. I call only FindWindowEx(), SetWindowsHookEx(), UnhookWindowsHookEx(), SendMessage(), PostMessage() and CallNextHookEx(). I export only two of four functions and use only four global variables. Why my relese DLL is ~50kb?? Is VS2003 adding soe other resources? I have seen some DLL's smaller than mine (10-20kb) - how is it possible?? Well, I actualy don't care about the size of this DLL, I'm just curious what makes it so 'big'??

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            PatrykDabrowski wrote:

            Why my relese DLL is ~50kb??

            Read here.


            "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

            "Judge not by the eye but by the heart." - Native American Proverb

            P 1 Reply Last reply
            0
            • D David Crow

              PatrykDabrowski wrote:

              Why my relese DLL is ~50kb??

              Read here.


              "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

              "Judge not by the eye but by the heart." - Native American Proverb

              P Offline
              P Offline
              PatrykDabrowski
              wrote on last edited by
              #6

              I've already read this article. It's interesting but I want to know why this DLL is so 'big' having only couple of functions and variables. I don't care how much memory it would take (adress space, heap etc.) and how to optimize it - I'm just curious what's inside this almost empty DLL. When I remove ALL functions/variables having only DllMain(){return TRUE;} I still get ~45kb DLL....

              D 1 Reply Last reply
              0
              • P PatrykDabrowski

                I've already read this article. It's interesting but I want to know why this DLL is so 'big' having only couple of functions and variables. I don't care how much memory it would take (adress space, heap etc.) and how to optimize it - I'm just curious what's inside this almost empty DLL. When I remove ALL functions/variables having only DllMain(){return TRUE;} I still get ~45kb DLL....

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                PatrykDabrowski wrote:

                It's interesting but I want to know why this DLL is so 'big' having only couple of functions and variables.

                "So big" in terms of the DLL's size on disk, or some number reported by Task Manager?


                "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                "Judge not by the eye but by the heart." - Native American Proverb

                P 1 Reply Last reply
                0
                • D David Crow

                  PatrykDabrowski wrote:

                  It's interesting but I want to know why this DLL is so 'big' having only couple of functions and variables.

                  "So big" in terms of the DLL's size on disk, or some number reported by Task Manager?


                  "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                  "Judge not by the eye but by the heart." - Native American Proverb

                  P Offline
                  P Offline
                  PatrykDabrowski
                  wrote on last edited by
                  #8

                  I mean the size of my DLL on disk.

                  1 Reply Last reply
                  0
                  • P PatrykDabrowski

                    I have a simple DLL project created in VS2003. I don't use MFC, just plain Windows API. I call only FindWindowEx(), SetWindowsHookEx(), UnhookWindowsHookEx(), SendMessage(), PostMessage() and CallNextHookEx(). I export only two of four functions and use only four global variables. Why my relese DLL is ~50kb?? Is VS2003 adding soe other resources? I have seen some DLL's smaller than mine (10-20kb) - how is it possible?? Well, I actualy don't care about the size of this DLL, I'm just curious what makes it so 'big'??

                    J Offline
                    J Offline
                    jonny5
                    wrote on last edited by
                    #9

                    Probably because you are statically linking to the C Runtime. There is an option there somewhere to not do that - so that it dynamically links.

                    Jon Humphreys ActivePlanet Software

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups