Skip to content

Commit

Permalink
Change symbol mangling on Windows to avoid conflicts (#5518)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexatos authored and RX14 committed Jan 3, 2018
1 parent 288af4b commit 44a4c63
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/compiler/crystal/codegen/codegen.cr
Expand Up @@ -2049,14 +2049,15 @@ module Crystal

def self.safe_mangling(program, name)
if program.has_flag?("windows")
name.gsub do |char|
case char
when '<', '>', '(', ')', '*', ':', ',', '#', '@', ' '
"."
when '+'
".."
else
char
String.build do |str|
name.each_char do |char|
if char.ascii_alphanumeric? || char == '_'
str << char
else
str << '.'
char.ord.to_s(16, str, upcase: true)
str << '.'
end
end
end
else
Expand Down

0 comments on commit 44a4c63

Please sign in to comment.