Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by Panzerschrek

5 hours ago

But what if I have a C++ dynamic library? Does it call constructors for global variables before _start function in the main program starts?

1 comment

Panzerschrek

Reply

bonzini  2 hours ago

_start takes care of calling the global initializers and register the atexit callback for the finalizers.

(In practice _start calls __libc_start_main, a libc function that handles all of that).

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities