How to pass a class by (const) reference to C++

Jan Jan at Krassnigg.de
Wed Dec 15 12:02:08 UTC 2021


On Wednesday, 15 December 2021 at 11:03:27 UTC, rikki cattermole 
wrote:
>
> On 15/12/2021 11:54 PM, Jan wrote:
>> On Wednesday, 15 December 2021 at 09:36:54 UTC, Jan wrote:
>>> Unfortunately it's the "annoying little details" that I 
>>> immediately bumped into.
>> 
>> Just another example: I just learned that linking against C++ 
>> DLLs is quite limited. I ran into the issue that linking in an 
>> external variable doesn't work (even though the mangled name 
>> that D chooses is correct), because DLLs work differently than 
>> static linking does.
>> Someone with more in-depth knowledge told me, that Windows 
>> support in D and specifically DLL support is lacking quite a 
>> bit.
>> 
>> Having *only* link compatibility is totally fine, D currently 
>> just doesn't fulfill that promise, especially not on Windows 
>> and especially not with DLLs.
>
> Are you sure that on the shared library side it was marked as 
> exported?
>
> If a symbol is not exported, there is no guarantee (nor reason 
> to think) that it will be visible during runtime linking to 
> said shared library/executable.
>
> This isn't unique to D, its just how linkers work.

Yep, checked that. Even checked the .exp file and compared the 
mangled name there with the mangled name that D tries to use, 
they are the same. I know someone who worked on improving DLL 
support for D a while back and he said he had to fix this in D 
but didn't get that merged into DMD back then (since there were 
many other things as well) and now he doesn't have time to work 
on it further :(


More information about the Digitalmars-d-learn mailing list