I was just perusing through msvcrt and noticed that in wcs.c there is an implementation of _vsnwprintf, which also exists, verbatim, in it's entirety, in ntdll/wcstring.c. Unless I am misunderstanding the .spec files there appears to be a method of "forward"ing a symbol to an external implementation, such as:
@ forward -noimport wcslen ntdll.wcslen
Is there any particular reason this was not done for _vsnwprintf as well? There is even a comment in the wcs.c copy saying to mirror any fixes in the ntdll copy.
Also, on perhaps a style note, I've noticed some implementations are prefixed by the dll name in all caps, such as MSVCRT_vfprintf, and some are not, such as _wmkdir. Is this just personal style or is there more to these differences?
On Wed, 23 May 2001, Mike Bond wrote:
I was just perusing through msvcrt and noticed that in wcs.c there is an implementation of _vsnwprintf, which also exists, verbatim, in it's entirety, in ntdll/wcstring.c. Unless I am misunderstanding the .spec files there appears to be a method of "forward"ing a symbol to an external implementation, such as:
@ forward -noimport wcslen ntdll.wcslen
Is there any particular reason this was not done for _vsnwprintf as well?
The problem is that _vsnwprintf is not exported by ntdll. On Win9x I don't see any *printf function in ntdll. But on Win2000 there is: _snprintf, _snwprintf, _vsnprintf, sprintf, swprintf and vsprintf. But no _vsnwprintf.
So according to the dll separation rules we must not make msvcrt depend on an API not exported by a regular windows dll. But in the case of ntdll I'm not sure. Can we use native ntdll in Wine? I don't think so since it also exports things like 'wine_dbgstr_[aw]n?'. So maybe we can bend the rules a little and export _vsnwprintf anyway. Better ask Alexandre...
[...]
Also, on perhaps a style note, I've noticed some implementations are prefixed by the dll name in all caps, such as MSVCRT_vfprintf, and some are not, such as _wmkdir. Is this just personal style or is there more to these differences?
There's more to it. Here are the MSVCRT conventions:
* any function name which may conflict with a regular C function is prefixed with 'MSVCRT_'. In particular this includes all functions that don't start with '_'. Example: vfprintf -> MSVCRT_vfprintf _errno -> MSVCRT__errno (exception)
* Any function name that will not conflict with a regular C function name is not prefixed. This includes most functions starting with a single '_'. Example: _access -> _access _wchmod -> _wchmod
* Internal functions are prefixed by 'msvcrt_', but I'm not sure I renamed strictly all of them (so there might still be internal functions prefixed with 'MSVCRT_').
(I say function but it's really any symbol)
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ We are Pentium of Borg. You will be approximated. Division is futile.