D has better way to bind to C++ than to D.

Dukc ajieskola at gmail.com
Thu Feb 23 12:53:15 UTC 2023


On Wednesday, 22 February 2023 at 19:26:40 UTC, Hipreme wrote:
> Even in an untemplated format, that would help me: (like 
> passing an optional symbol saying it is a template.
> ```d
> extern(D, "hip.util.conv", to) extern string to(int);
> ```

Yeah, we're supposed to define or generate a header module that 
has the same name as the real module. It can probably be also 
accomplished with some really ugly `pragma(mangle, "...")` 
trickery, but I agree that defining module names in `extern(D)` 
would be much nicer and sometimes a better solution than a header 
file for every linked-to source file. D ABI should be just as 
practical for separate compilation as C and C++ ABIs.



More information about the Digitalmars-d mailing list