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#
  4. How can i change the base address of my dll

How can i change the base address of my dll

Scheduled Pinned Locked Moved C#
helpquestion
8 Posts 3 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.
  • T Offline
    T Offline
    Timothy_1982
    wrote on last edited by
    #1

    Project Properties - Build - Advanced in this dialogbox you can change the dll base address, but that ain't working for me, i always get the error DISP_E_BADVARTYPE. How come? Am i entering an invalid number? Can someone help me out here? thx

    D 1 Reply Last reply
    0
    • T Timothy_1982

      Project Properties - Build - Advanced in this dialogbox you can change the dll base address, but that ain't working for me, i always get the error DISP_E_BADVARTYPE. How come? Am i entering an invalid number? Can someone help me out here? thx

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      The Base Address must be a multiple of 64K (65536 decimal), cannot be lower than 64K * 256 and cannot be higher than 64K * 32768.

      Dave Kreskowiak Microsoft MVP - Visual Basic

      G T 2 Replies Last reply
      0
      • D Dave Kreskowiak

        The Base Address must be a multiple of 64K (65536 decimal), cannot be lower than 64K * 256 and cannot be higher than 64K * 32768.

        Dave Kreskowiak Microsoft MVP - Visual Basic

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        One of the rare cases where the number 42 won't do. ;)

        --- b { font-weight: normal; }

        1 Reply Last reply
        0
        • D Dave Kreskowiak

          The Base Address must be a multiple of 64K (65536 decimal), cannot be lower than 64K * 256 and cannot be higher than 64K * 32768.

          Dave Kreskowiak Microsoft MVP - Visual Basic

          T Offline
          T Offline
          Timothy_1982
          wrote on last edited by
          #4

          Big thx, i would give each assembly a fixed address, but how do i know how much space i have to leave between the addresses given to 2 different dll's?

          D 1 Reply Last reply
          0
          • T Timothy_1982

            Big thx, i would give each assembly a fixed address, but how do i know how much space i have to leave between the addresses given to 2 different dll's?

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            You don't really. Not without some work in the debugger to figure out what your resulting code size is anyway. Why do you think you need to do this anyway? The only real benefit is to speed up loading assemblies, but only slightly. All you're doing is (trying to) save the loader from having to calculate a starting address for you. This can also introduce unexpected problems. If an assembly won't fit in a hole that exists at the address you specify, or if the address is already being used by another assembly, then you actually increase the time it takes to load the assembly as the loader has to calculate a new address. -- modified at 12:05 Saturday 19th August, 2006

            Dave Kreskowiak Microsoft MVP - Visual Basic

            T 1 Reply Last reply
            0
            • D Dave Kreskowiak

              You don't really. Not without some work in the debugger to figure out what your resulting code size is anyway. Why do you think you need to do this anyway? The only real benefit is to speed up loading assemblies, but only slightly. All you're doing is (trying to) save the loader from having to calculate a starting address for you. This can also introduce unexpected problems. If an assembly won't fit in a hole that exists at the address you specify, or if the address is already being used by another assembly, then you actually increase the time it takes to load the assembly as the loader has to calculate a new address. -- modified at 12:05 Saturday 19th August, 2006

              Dave Kreskowiak Microsoft MVP - Visual Basic

              T Offline
              T Offline
              Timothy_1982
              wrote on last edited by
              #6

              yep that is why i'm using it, to speed up the time of loading. But i'm just testing it out, now i saw it makes almost no difference. I also read by using NGEN, u can precompile your assemblies to use, does that help the speed of loading the application? I'm using an installer for install my project on client pc. So then i have to add a function to execute NGEN in a custom action in my installer?

              D 1 Reply Last reply
              0
              • T Timothy_1982

                yep that is why i'm using it, to speed up the time of loading. But i'm just testing it out, now i saw it makes almost no difference. I also read by using NGEN, u can precompile your assemblies to use, does that help the speed of loading the application? I'm using an installer for install my project on client pc. So then i have to add a function to execute NGEN in a custom action in my installer?

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                Timothy_1982 wrote:

                to speed up the time of loading. But i'm just testing it out, now i saw it makes almost no difference.

                Yeah, it doesn't take that long to calculate a new load address...unless you've got LOTS of .DLL's being loaded.

                Timothy_1982 wrote:

                by using NGEN, u can precompile your assemblies to use, does that help the speed of loading the application?

                Yes it does. Probably not as much as you're hoping though. Alot of the overhead you see launching a .NET application is the startup of the Framework itself. There's just about nothing you can do about that.

                Timothy_1982 wrote:

                I'm using an installer for install my project on client pc. So then i have to add a function to execute NGEN in a custom action in my installer?

                That's typically how it's done. Since NGEN produces binaries that are VERY processor specific, you can't just NGEN yourself a precompiled app and distribute that to everyone. Best practice is to include the NGEN step in the customer install and NGEN the application assemblies as the last step in your installation, using a custom action.

                Dave Kreskowiak Microsoft MVP - Visual Basic

                T 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  Timothy_1982 wrote:

                  to speed up the time of loading. But i'm just testing it out, now i saw it makes almost no difference.

                  Yeah, it doesn't take that long to calculate a new load address...unless you've got LOTS of .DLL's being loaded.

                  Timothy_1982 wrote:

                  by using NGEN, u can precompile your assemblies to use, does that help the speed of loading the application?

                  Yes it does. Probably not as much as you're hoping though. Alot of the overhead you see launching a .NET application is the startup of the Framework itself. There's just about nothing you can do about that.

                  Timothy_1982 wrote:

                  I'm using an installer for install my project on client pc. So then i have to add a function to execute NGEN in a custom action in my installer?

                  That's typically how it's done. Since NGEN produces binaries that are VERY processor specific, you can't just NGEN yourself a precompiled app and distribute that to everyone. Best practice is to include the NGEN step in the customer install and NGEN the application assemblies as the last step in your installation, using a custom action.

                  Dave Kreskowiak Microsoft MVP - Visual Basic

                  T Offline
                  T Offline
                  Timothy_1982
                  wrote on last edited by
                  #8

                  thx for all the answers, clear and usefull. ;)

                  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