Thread overview
[Issue 12627] extern(C++) interfaces should format
Apr 24, 2014
yebblies
Feb 13, 2021
Walter Bright
Dec 17, 2022
Iain Buclaw
April 24, 2014
https://issues.dlang.org/show_bug.cgi?id=12627

yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com

--- Comment #1 from yebblies <yebblies@gmail.com> ---

The requested example of how to create classes usable through extern(C++) interfaces - pretty much how you'd expect.

import std.stdio;

extern(C++)
interface I
{
    void fun();
}

extern(C++)
class C : I
{
    void fun() { writeln("This works..."); }
}

class D : I
{
extern(C++):
    void fun() { writeln("And so does this!"); }
}

void main()
{
    I i = new C();
    i.fun();
    i = new D();
    i.fun();
}

--
April 24, 2014
https://issues.dlang.org/show_bug.cgi?id=12627

--- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> ---
Thanks.

An updated unit test:

version(unittest)
{
   extern(C++) interface X
   {
   }

   extern(C++) class C : X
   {
   }
}

unittest
{
   X x = new C;
   string expected = format("%X", cast(void *)x);
   formatTest(x, expected); // fails, x is printed as 'null'
}

@yebblies While fiddling around, I found an issue with extern(C++) classes (not
related to this). See issue #12636

--
February 13, 2021
https://issues.dlang.org/show_bug.cgi?id=12627

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=3248

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=12627

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
December 01
https://issues.dlang.org/show_bug.cgi?id=12627

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/10048

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--