Replying to my own question, on Windows gcc does support ctor/dtor so, IHMO, tcc should do the same.
Taking Herman's 108_constructor.c gcc 9.1 Mingw64 gives: C:>gcc foo.c -o foo.exe C:>file foo.exe foo.exe: PE32+ executable (console) x86-64, for MS Windows C:>foo constructor main destructor -----Original Message----- From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of Michael Matz Sent: Monday, October 28, 2019 10:40 To: Herman ten Brugge via Tinycc-devel Cc: Herman ten Brugge Subject: Re: [Tinycc-devel] constructor/destructor support Hello, On Fri, 25 Oct 2019, Herman ten Brugge via Tinycc-devel wrote: > I implemented constructors and destructors. This was the one thing I was > missing for my own project. > > See the attachment. > > Can I push it? Could you please refactor some things? In particular the duplicate code of add_init_array and add_fini_array: instead add just one function (add_sec_array?) that takes the name of the section. Also if you test the section size for being != 0 before creating the dynamic tags (DT_INIT* and friends) it might be that you can avoid having to add the 'create' argument to find_section; it would be nice to not have to have it. Otherwise, looks good. Thanks for the work. (And yeah, bonus points for Windows and -run support :) ). Ciao, Michael. _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel