[Issue 24577] Struct with constructor returned from C++ wrong
https://issues.dlang.org/show_bug.cgi?id=24577 Tim changed: What|Removed |Added Keywords||C++ --
[Issue 24577] New: Struct with constructor returned from C++ wrong
https://issues.dlang.org/show_bug.cgi?id=24577 Issue ID: 24577 Summary: Struct with constructor returned from C++ wrong Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: tim.dl...@t-online.de testcpp.cpp // struct S { int i; S(); S(int i); }; S::S() : i(0) { } S::S(int i) : i(i) { } S f() { S r; r.i = 5; return r; } test.d import std.stdio; extern(C++) struct S { int i; this(int i); } extern(C++) S f(); void main() { S s = f(); writeln("test ", s); stdout.flush(); assert(s.i == 5); } The above example can be compiled on Windows with: cl /c testcpp.cpp dmd -g -w -m64 test.d testcpp.obj When running it will print a wrong random number: test S(-246417088) It only fails for DMD on Windows with -m64. It works correctly with -m32mscoff or on Linux or OSX. --
[Issue 15587] Enable use of D keywords as identifiers when interfacing to C/C++
https://issues.dlang.org/show_bug.cgi?id=15587 Tim changed: What|Removed |Added CC||tim.dl...@t-online.de --- Comment #4 from Tim --- 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. --
[Issue 24576] Now that OMF support has been dropped, the standard library should be called `phobos32` not `phobos32mscoff`
https://issues.dlang.org/show_bug.cgi?id=24576 kinke changed: What|Removed |Added CC||ki...@gmx.net --- Comment #1 from kinke --- I'd argue it's time to drop any ugly suffix and just go with `phobos2.lib` whn revising this, as on Posix. Note that the 32-bit lib is currently in a `lib32mscoff` directory too, in the install package. So changing this entails the Phobos Makefile, the compiler sc.ini + hardcoded stuff, and the installer repo; possibly more. --
[Issue 24577] Struct with constructor returned from C++ wrong
https://issues.dlang.org/show_bug.cgi?id=24577 kinke changed: What|Removed |Added CC||ki...@gmx.net --- Comment #1 from kinke --- I'm pretty sure there's an existing issue about this. IIRC, it's backend specific, LDC working fine. It boils down to MSVC++ having separate POD semantics - any struct with an explicit constructor makes it a non-POD. Such types are returned via sret (caller passing a pointer to the pre-allocated result). --
[Issue 24576] Now that OMF support has been dropped, the standard library should be called `phobos32` not `phobos32mscoff`
https://issues.dlang.org/show_bug.cgi?id=24576 --- Comment #2 from Nicholas Wilson --- the different directory and the smattering of Makefiles changes, compiler sc.ini, etc. was part of the reason that this was such a PITA to try to change it. We should have it configured in one place ideally. --