Compiling a mixed D and C++ project?

Kyle De'Vir kyle.devir at mykolab.com
Tue Sep 3 09:12:06 UTC 2019


On Tuesday, 3 September 2019 at 08:57:56 UTC, Jacob Carlborg 
wrote:
>
> No, not necessarily. He has created C wrappers around the C++ 
> code and is treating the C++ class as an opaque pointer. Have a 
> look here [1].
>
>> Also, that's just a weird line; what does it mean? I haven't 
>> seen an
>> `extern __gshared` struct before... but I think you mean:
>>    extern(C++) class QtApplication;
>>    QtApplication TestApplication_Init();
>> 
>
> I think the actual problem is lines 32-35. The arguments to 
> main are casted to a pointer to a D array, that won't work. It 
> needs to be a C array, i.e. a pointer to a point of char. You 
> can access the arguments to main as a C array from here [2].
>
> [1] https://invent.kde.org/snippets/433
> [2] https://dlang.org/phobos/core_runtime.html#.CArgs

This worked! Thank you! :)


More information about the Digitalmars-d mailing list