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

Mathias LANG geod24 at gmail.com
Thu Feb 23 09:31:28 UTC 2023


On Wednesday, 22 February 2023 at 20:22:18 UTC, Paul Backus wrote:
> On Wednesday, 22 February 2023 at 19:26:40 UTC, Hipreme wrote:
>> Given the following situation: I want to use an externally 
>> defined D symbol in my current library without adding it as a 
>> dependency.
>>
>>
>> - I don't want to use an import path to bind to a symbol in D 
>> because this would complicate even more my build system, we 
>> already do it from C by doing: `extern(C) void something();`
>
> I think the real question here is, why don't you want to do 
> this using `import`? What's the actual root cause of this 
> "complication" you refer to? Better to address that problem 
> directly than to add a new language feature as a workaround.

I agree, you shouldn't do that. But having `extern` symbols in a 
module is currently useless. I had a fix for it but Walter 
rejected it: https://github.com/dlang/dmd/pull/12839


More information about the Digitalmars-d mailing list