Hello,
The attachment contains the 32-bit and 64-bit versions of the import library for Universal C Runtime. The libraries are created from the text file listing the functions exported by UCRT.
A quick example :
#include <stdio.h>
#include <stdarg.h>
extern FILE* __cdecl __acrt_iob_func(unsigned Index);
#define _stdin (__acrt_iob_func(0))
#define _stdout (__acrt_iob_func(1))
#define _stderr (__acrt_iob_func(2))
char *_strupr(char *str);
unsigned long _getdrives( void );
int __cdecl __stdio_common_vfprintf(unsigned __int64 _Options, FILE* _Stream, char const* _Format , int _Locale, va_list);
int printf(const char * format, ...)
{
int retVal;
va_list vl;
va_start(vl, format);
retVal = __stdio_common_vfprintf(0, _stdout,format, 0, vl);
va_end(vl);
return retVal;
}
int main(int argc,char *argv[])
{
char szDrvMsg[] = "A:\n";
char mystr[]="This is a string printed with UCRT printf.\n";
unsigned long uDriveMask;
printf("%s\n",_strupr(mystr));
printf("Detected logical drives:\n");
uDriveMask = _getdrives();
while (uDriveMask) {
if (uDriveMask & 1)
printf(szDrvMsg);
++szDrvMsg[0];
uDriveMask >>= 1;
}
return 0;
}
Determining the functions imported by the example code :
\PellesC\bin\podump.exe /IMPORTS Hello32.exe
Dump of Hello32.exe
File type: EXE
Imported symbols
api-ms-win-crt-stdio-l1-1-0.dll
0 time date stamp (Thu Jan 1 03:00:00 1970)
hint name
0 __acrt_iob_func
3 __stdio_common_vfprintf
api-ms-win-crt-string-l1-1-0.dll
0 time date stamp (Thu Jan 1 03:00:00 1970)
hint name
3D _strupr
api-ms-win-crt-filesystem-l1-1-0.dll
0 time date stamp (Thu Jan 1 03:00:00 1970)
hint name
15 _getdrives
KERNEL32.dll
0 time date stamp (Thu Jan 1 03:00:00 1970)
hint name
0 GetCommandLineA
0 ExitProcess
Thanks for sharing!
I may be dense, but what is the benefit over using Pelles C functions directly?
Hi Akko,
Pelle's C run-rime library is very good. If one day MS is deciding to remove the traditional msvcrt.dll, the replacement will be the new Universal C Runtime. My library is just an attempt to be prepared for tomorrow.
If someone want to compare different functions, how those works other than Pelles C crt, how someone do that without different compiler system ?
msvcrt.dll and ucrtbase.dll + others are Windows OS dlls, that will be mostly in every Windows OSes
Also a linker's map-file is easier to read.
Also poasm users needs simple way to print out variables, while testing and sharing code examples.
Hello,
The MS tools to build the import libraries can be obtained from here :
https://github.com/Data-Oriented-House/PortableBuildTools