Thanks Jonathan,
Using only winnls.h from this archive and by removing comment winnls.h from windows.h I’m also able to compile sqlite. I take the responsibility to push this change in mod. We’ll see how maintainers will decide to handle other Windows includes later. Sqlite is an important component (very slow to compile on some machines) and it’s nice to have it compiled at light speed with tcc. I’m sure sqlite maintainers will enjoy to be able to use tcc. Can you tell them so that they may officially support tcc in all future releases? C. From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of Jonathan Newman Sent: mardi 1 janvier 2019 08:38 To: tinycc-devel@nongnu.org Subject: Re: [Tinycc-devel] Function pointers declared in a particular way result in a miscompilation Hi Christian, I should have mentioned- my unmodified sqlite build was with these headers (linked somewhere on the official site): http://download.savannah.gnu.org/releases/tinycc/winapi-full-for-0.9.27.zip I'm also unsure why these are distributed separately/what the rights situation is. It would definitely be nice to clear that up and bundle them with the next release if possible. - Jonathan On Tue, 1 Jan 2019, 07:29 Christian Jullien <eli...@orange.fr wrote: Thanks Michael and Jonathan. Unless I’m missing something in flag or config, sqlite does not compile ROOTB. I add to include this dirty patch in sqlite3.c int MultiByteToWideChar(void); int WideCharToMultiByte(void); #define CP_ACP 0 #define CP_UTF8 65001 #define CP_OEMCP 1 In fact, missing declarations are in standard winnls.h Windows header which does not exists in tcc distrib and is explicitly removed (by Grischka?) from windows.h Line 70: //gr #include <winnls.h> Which winnls.h have we the rights to include in standard tcc distrib? We could take the one from MinGW but includes many others includes not present in tcc (should we take them all in tcc standard distrib?). The ones from PellsC/Watcom/lcc are lighter but I’ve no ideas if we have the rights to do so. A quick and dirty solution would be to include winnsl.h with only definitions required to compile sqlite and let other people complete this first version with other declaration. Wdyt? From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis <mailto:tinycc-devel-bounces%2Beligis> =orange...@nongnu.org] On Behalf Of Jonathan Newman Sent: mardi 1 janvier 2019 00:25 To: tinycc-devel@nongnu.org Subject: Re: [Tinycc-devel] Function pointers declared in a particular way result in a miscompilation Many thanks Michael! I can confirm SQLite now compiles correctly on win32. On Mon, 31 Dec 2018 at 21:06, Michael Matz <matz....@frakked.de> wrote: Hello, On Sat, 29 Dec 2018, Jonathan Newman wrote: > Hi,This seems to be the issue causing SQLite compilation to fail (or at > least part of it/related to it). > > When a function pointer is declared in a particular way, it seems that > __stdcall (and presumably other attributes?) are ignored. As a result, TCC > thinks the function is caller-cleanup when it is not, and the stack gets > "cleaned" twice. > > See the full test case attached. As a quick summary, > > This works: > ((int __stdcall (*)(int, int, int))some_stdcall_func) (2, 0, 0); > > And so does this: > ((int(*__stdcall)(int, int, int))some_stdcall_func) (3, 0, 0); > > But this fails: > ((int(__stdcall*)(int, int, int))some_stdcall_func) (4, 0, 0); Aha, thanks for the investigation and testcase, that really helps. This particular problem is now fixed on trunk. Lacking win32 I can't check if it completely fixes SQLite, but at least your testcase works when cross compiled and run under wine. 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
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel