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. .NET (Core and Framework)
  4. Difference between .Net and VC dll delayload?

Difference between .Net and VC dll delayload?

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpquestion
2 Posts 2 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.
  • A Offline
    A Offline
    alias0018
    wrote on last edited by
    #1

    Hi all, Do you noticed a difference about dll delay-load for assembly? We know that assembly is delay-loaded by default, and it is configurable for VC. But there is a difference on when will it loaded... in VC, the dll will be loaded only when code reached exactly the line that need another dll. in .Net, it will load once it get into the method that calls another dll's code. ex: Dll1.dll class Class1 { void Fun() { int dummy = 0; Dll2.Class1.Fun(); } } Dll2.dll class Class1 { void Fun(){} } For VC, it load Dll2 when code reached "Dll2.Class1.Fun();" For .Net, it load Dll2 when code reached "int dummy = 0;" any one can tell me why there is such a difference? thanks in advance.

    do it.

    S 1 Reply Last reply
    0
    • A alias0018

      Hi all, Do you noticed a difference about dll delay-load for assembly? We know that assembly is delay-loaded by default, and it is configurable for VC. But there is a difference on when will it loaded... in VC, the dll will be loaded only when code reached exactly the line that need another dll. in .Net, it will load once it get into the method that calls another dll's code. ex: Dll1.dll class Class1 { void Fun() { int dummy = 0; Dll2.Class1.Fun(); } } Dll2.dll class Class1 { void Fun(){} } For VC, it load Dll2 when code reached "Dll2.Class1.Fun();" For .Net, it load Dll2 when code reached "int dummy = 0;" any one can tell me why there is such a difference? thanks in advance.

      do it.

      S Offline
      S Offline
      Super Lloyd
      wrote on last edited by
      #2

      You are quite allright. why is it so? In C you just blindly on the address and hope it works. In .NET the JIT (Just In Time compiler) will compile the method on first call (i.e. transform it from MSIL to machine language), doing so it will make sure all calls are valid, hence it needs to check that all method call are reachable and with the right signature, i.e. it needs to load the DLL and check a few things such as: the dll exist, the version is right, the target methods exist, with the right signature, etc... Otherwise the method will be deemed invalid and an exception will be thrown

      A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

      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