-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e88abac
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
d_demangle: | ||
dmd -c demangle.d | ||
dmd -oflibd_demangle.so demangle.o -shared -defaultlib=libphobos2.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# d_demangler | ||
|
||
A small utility to demange D symbols |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import std.demangle : demangle; | ||
import std.conv : to; | ||
import std.string : toStringz; | ||
import core.stdc.string : strncpy; | ||
|
||
extern (C) int demangle_symbol(const(char)* c_name, char* buffer, int size) | ||
{ | ||
const auto name = to!string(c_name); | ||
auto demangled = demangle(name); | ||
|
||
if (name == demangled) { | ||
return 0; | ||
} | ||
|
||
const auto c_demangled = toStringz(demangled); | ||
strncpy(buffer, c_demangled, size - 1); | ||
|
||
return 1; | ||
} |