How to make D resolve C++ symbols by mangling symbols with the Itanium ABI on Windows

user1234 user1234 at 12.de
Mon Feb 26 20:07:55 UTC 2024


On Monday, 26 February 2024 at 19:50:31 UTC, user1234 wrote:
> On Monday, 26 February 2024 at 17:23:32 UTC, thumbgun wrote:
>> [...]
>
> I see. That would be extremely painful. Could CTFE help here ?
>
> ```d
> string getRightMangling(alias T)()
> {
>     return "todo" // ;)
> }
>
> pragma(mangle, getRightMangling!(add))
> extern(C++) int add(int lhs, int rhs);
> ```
>
> That's not a serious suggestion but I'm still curious to see 
> how that would scale.
>
> Also that looks weird that the pragma refers to what it is 
> supposed to affect, not sure that would work, although in 
> theory D manages forward refs.

Turns out that the forward ref is not a problem. Remains the 
question of writing a mangler working fast at compile time ;)


More information about the Digitalmars-d mailing list