Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
January 20, 2016 [Issue 15587] Enable use of D keywords as identifiers when interfacing to C/C++ | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15587 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |C++ -- |
January 22, 2016 [Issue 15587] Enable use of D keywords as identifiers when interfacing to C/C++ | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15587 --- Comment #1 from Sobirari Muhomori <dfj1esp02@sneakemail.com> --- Another option: extern (C++) int __symbol__with(); And let C++ mangler recognize and remove the __symbol__ prefix. Choose your naming convention: alias with_ = __symbol__with; alias _with = __symbol__with; alias _with_ = __symbol__with; alias With = __symbol__with; -- |
July 08, 2017 [Issue 15587] Enable use of D keywords as identifiers when interfacing to C/C++ | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15587 --- Comment #2 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> --- In this particular case, the easiest workaround is to use pragma(mangle), right? I understand that this is more useful for C++ functions, whose mangling is non-trivial. -- |
February 19, 2020 [Issue 15587] Enable use of D keywords as identifiers when interfacing to C/C++ | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15587 Mathias LANG <pro.mathias.lang@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pro.mathias.lang@gmail.com --- Comment #3 from Mathias LANG <pro.mathias.lang@gmail.com> --- For C `pragma(mangle)` is an easy workaround, however for `extern(C++)`, not only is the mangling non-trivial, but it's currently impossible to do for anything templated, since the mangling depend on template parameters which are not available to `pragma(mangle)`. -- |
December 17, 2022 [Issue 15587] Enable use of D keywords as identifiers when interfacing to C/C++ | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15587 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P4 -- |
June 01 [Issue 15587] Enable use of D keywords as identifiers when interfacing to C/C++ | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15587 Tim <tim.dlang@t-online.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tim.dlang@t-online.de --- Comment #4 from Tim <tim.dlang@t-online.de> --- Using `pragma(mangle)` is also annoying for type names, because every function using the renamed type needs to use the changed mangling. This is for example necessary for `std::function`, because `function` is a keyword in D. It would be nice if you could change the mangled name of a type once and every function using the type gets the changed name automatically. It could look something like this: ``` import core.stdcpp.xutility : StdNamespace; import std.traits; extern(C++, (StdNamespace)) extern(C++, class) pragma(mangle_name, "function") // This type is called function in C++ struct std_function(F) { // ... } extern(C++) void f(ref const std_function!(FunctionTypeOf!(void function())) callback); ``` Currently every function like `f` using `std_function` would need `pragma(mangle)` and the exact mangling depends on operating system and processor architecture. It is possible to generate the correct mangling using CTFE, but this still needs to be done for every function. -- |
Copyright © 1999-2021 by the D Language Foundation