Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement snprintf on win32 #5533

Merged
merged 1 commit into from
Jan 4, 2018
Merged

Conversation

RX14
Copy link
Contributor

@RX14 RX14 commented Jan 4, 2018

x86_64-pc-windows-msvc doesn't export the snprintf symbol, only the vsnprintf symbol. This means we need to define out own snprintf implementation which captures va_args correctly.

x86_64-pc-windows-msvc doesn't export the snprintf symbol, only the vsnprintf
symbol. This means we need to define out own snprintf implementation which
captures va_args correctly.
@RX14 RX14 added this to the Next milestone Jan 4, 2018
@RX14 RX14 merged commit b293b01 into crystal-lang:master Jan 4, 2018
@oprypin
Copy link
Member

oprypin commented Feb 16, 2020

This wrapper actually doesn't seem necessary; using snprintf directly works.

https://github.com/oprypin/crystal/actions/runs/40214382

Could be related to

Beginning with the UCRT in Visual Studio 2015 and Windows 10, snprintf is no longer identical to _snprintf. The snprintf function behavior is now C99 standard compliant.

https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=vs-2019

so perhaps before VS2015 this name was a macro pointing towards _snprintf?

@RX14
Copy link
Contributor Author

RX14 commented Feb 17, 2020

I'm not sure, at least at the time, this didn't work. When I read the msvcrt header files I found that it was an inline method identical to the one in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants