Skip to content

Commit

Permalink
Corrects lib lookup in case-sensitive OSes
Browse files Browse the repository at this point in the history
Downcase name of Windows import libraries to avoid duplicates references
(Eg. kernel32 and Kernel32) but to correctly find the libraries on
case-sensitive filesystems, like when cross-compiling from Linux.

While on Windows `Kernel32` and `kernel32` result in the correct library
found for linking, it does not work the same way when cross-compiling.

This also applies to Winsock2 (ws2_32) usage.

The change normalizes on the usage of downcased names for these
libraries (which will have no impact when compiling natively on
Windows).
  • Loading branch information
luislavena committed Jan 21, 2025
1 parent b103c28 commit 965f02d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib_c/x86_64-windows-msvc/c/libloaderapi.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "c/winnt"

@[Link("Kernel32")]
@[Link("kernel32")]
lib LibC
alias FARPROC = Void*

Expand Down
2 changes: 1 addition & 1 deletion src/lib_c/x86_64-windows-msvc/c/winsock2.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require "./basetsd"
require "./guiddef"
require "./winbase"

@[Link("WS2_32")]
@[Link("ws2_32")]
lib LibC
alias SOCKET = UINT_PTR

Expand Down

0 comments on commit 965f02d

Please sign in to comment.