www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - documentation for C/C++ interop

would someone care to work on updating this?  I understand from 
Daniel's post in main list that the only thing that doesn't work 
is special member functions.  that's different from what the 
documents say, and it is surely something important for D that 
people are aware of this.

I don't really know C++, so I won't be much good at writing it, 
otherwise I would have a first stab at it myself.

But I tried with the following toy, which worked fine:

import std.stdio;

extern(C++) struct Test
{
	int i;

	extern(C++) void mutate()
	{
		i+=10;
		//test="goodbye".dup.ptr;
	}
}

extern(C++) void callme(Test* test);

void main(string[] args)
{
	Test test;
	writefln("%s",test);
	test.mutate;
	writefln("%s",test);
	callme(&test);
	writefln("%s",test);
}

#include <stdio.h>

struct Test
{
	int i;
	public:
		void mutate();
};

void callme(struct Test* test)
{
	test->i=(test->i)+1;
	test->mutate();
}
Aug 27 2015