tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Windows C99 missing functions: strtoll and strtoull


From: Christian Jullien
Subject: [Tinycc-devel] Windows C99 missing functions: strtoll and strtoull
Date: Fri, 4 Nov 2022 11:26:56 +0100

Hi,

 

If you watched the recent posts about GNUmake tcc port on Windows, you’ve seen that strtoll and strtoull C99 functions are missing

 

I tried to add strtoll and strtoull to msvcrt.def but fails when running executable because they are not part of msvcrt.dll

c:\Windows\System32>strings msvcrt.dll | grep strto | grep -v _

strtod

strtok

strtok_s

strtol

strtoul

 

It is however found in ucrtbase.dll which exists since Windows 10

 

c:\Windows\System32>strings ucrtbase.dll | grep strto | grep -v _

strtod

strtof

strtoimax

strtok

strtol

strtold

strtoll

strtoul

strtoull

strtoumax

 

What is the correct way to support strtoll and strtoull C99 functions on Windows?

 

#define strtoll stroi64

#define strtoull stroui64

 

Or perhaps a static inline definitions in stdlib.h like:

static long long  __cdecl strtoll(const char* __restrict__ str, char** __restrict endptr, int base) {

    return strtoi64(str, endptr, base);

}

 

would do for x64 port

 

I still can’t understand how VisualC++ can find strtoll as it uses the same dll (with missing strto[u]ll definitions)

c:\usr\jullien\openlisp>ldd foo.exe

        ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ff8c65f0000)

        KERNEL32.DLL => /cygdrive/c/WINDOWS/System32/KERNEL32.DLL (0x7ff8c4c30000)

        KERNELBASE.dll => /cygdrive/c/WINDOWS/System32/KERNELBASE.dll (0x7ff8c3e20000)

 

Probably because mapping.h defines:

 

/**

* Map stroll to _strtoi64

*

* stroll does not properly map in Windows; this is needed to ensure calls to

* strtoll(const char *nptr, char **endptr, int base) will compile in Windows.

*/

#define strtoll _strtoi64

 

/**

* Map strtoull to _strtoui64

*

* strtoull does not properly map in Windows; this is needed to ensure calls to

* strtoull(const char *nptr, char **endptr, int base) will compile in Windows.

*/

#define strtoull _strtoui64

 

 

Fix is welcome.

 

 

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]