Skip to content

Commit

Permalink
Windows: Remove the workaround using vsnprintf. (#8942)
Browse files Browse the repository at this point in the history
This is not needed, the functions are both defined in legacy_stdio_definitions.cpp in the same way. So use snprintf directly.

This partly reverts commit b293b01.

But add Link(legacy_stdio_definitions), as that's where these functions reside now, since VS 2015.
https://docs.microsoft.com/en-us/cpp/porting/visual-cpp-change-history-2003-2015?view=vs-2019#stdio_and_conio
(This one is needed regardless of this change)
  • Loading branch information
oprypin authored Mar 26, 2020
1 parent 9dbd914 commit c8c6685
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/lib_c/x86_64-windows-msvc/c/stdio.cr
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
require "./stddef"

@[Link("legacy_stdio_definitions")]
lib LibC
fun printf(format : Char*, ...) : Int
fun rename(old : Char*, new : Char*) : Int
fun vsnprintf(str : Char*, size : SizeT, format : Char*, ap : VaList) : Int
fun snprintf = __crystal_snprintf(str : Char*, size : SizeT, format : Char*, ...) : Int
end

fun __crystal_snprintf(str : LibC::Char*, size : LibC::SizeT, format : LibC::Char*, ...) : LibC::Int
VaList.open do |varargs|
LibC.vsnprintf(str, size, format, varargs)
end
fun snprintf(buffer : Char*, count : SizeT, format : Char*, ...) : Int
end

0 comments on commit c8c6685

Please sign in to comment.