Status of Win32 C++ interop

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 4 09:19:47 PDT 2015


On Friday, 4 September 2015 at 14:18:40 UTC, Benjamin Thaut wrote:
> On Friday, 4 September 2015 at 10:04:48 UTC, Szymon Gatner 
> wrote:
>> On Friday, 4 September 2015 at 09:27:14 UTC, Benjamin Thaut 
>> wrote:
>>> On Friday, 4 September 2015 at 09:07:39 UTC, Szymon Gatner 
>>> wrote:
>>>>
>>>> What about 32bit phobos? Last time I checked (2.067) only 
>>>> x64 was distributed.
>>>
>>> You have to compile it yourself. Use the win64 makefile and 
>>> replace the arch=64 with
>>> arch=32mscoff.
>>>
>>> For more details see here:
>>> http://www.digitalmars.com/d/archives/digitalmars/D/learn/How_to_get_32mscoff_libraries_for_phobos_73980.html
>>
>> Ah so that didn't change. Did you try it? Do you run hybrid 
>> C++/D apps on Win (whether 32 or 64)?. Asking because last 
>> time I tried it (Win x64 tho) writeln() call from D side 
>> crashed app because stdio wasn't properly initialized even tho 
>> rt_init() was successful.
>
> I am running hybrid D/C++ apps. I found it to work best when 
> you give D the control over the main method, e.g. the program 
> entry point should be in D land. Then simply call a C++ 
> function from there to initialize your c++ stuff.
>
> I'm currently even running hybrid C++/D apps with dlls. E.g. 
> multiple D dlls + multiple C++ dlls loaded by a c++ main 
> program. But to do that I have heavy compiler + runtime 
> modifications which are not ready yet to do a PR for them.

Hi Benjamin

Would you be able to give a little more colour on what the limits 
are of interoperability for C++ with DMD master or release ?  As 
I understand it destructors and constructors don't work, and 
obviously it will get tricky passing structures and classes from 
C++ libraries not ported to D.

Reason I ask is I am about to make a case to someone as to why we 
should use D, and I don't want to make any unfounded claims.  I 
don't really know C++ myself, although my noddy test worked fine.

Thanks - and we should bring the doc page IP to date.  At least 
say that more works than currently described, as I am sure this 
will be a factor in adoption.


Laeeth.



More information about the Digitalmars-d-learn mailing list