Sunday, June 7, 2009

Dynamic vs Static Linking to the C Runtime

Historically I've always statically linked to the C runtime, the intention being that I didn't want to force users to the engine to have to download an updated runtime in order to run it. However, recent events (and thanks to Spirit for the suggestion) have uncovered an interesting fact: the engine will always attempt to dynamically link anyway, even if I've told it to statically link.

Anyway, with that in mind I'm starting to wonder if I should revise my preference here. So far as I can see, the sole advantage of statically linking (and it was a big enough one to outweigh the advantages of dynamically linking) is gone, so I'm thinking of switching over. Advantages of dynamically linking seem to me to currently include:

  • Being able to use updated versions of the runtime, which may contain important bugfixes.
  • Being able to mix and match managed and native code in a single executable.
  • Reducing the executable size.
  • Better compatibility between the core engine code and whatever it is in there that's dynamically linking.
So overall, this seems like being something I might do sooner rather than later.

0 comments: