Does RTTI and exceptions work in dlls on windows?

Benjamin Thaut via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 25 23:10:44 PST 2014


Am 25.11.2014 21:46, schrieb MrSmith:
> On Tuesday, 25 November 2014 at 18:39:56 UTC, Benjamin Thaut wrote:
>> Am 24.11.2014 19:20, schrieb MrSmith:
>>> I've got little test here
>>> https://gist.github.com/MrSmith33/8750dd43c0843d45ccf8#file-sharedmodule2-d-L17-L29.
>>>
>>>
>>>
>>> I have one application and two dlls. Application loads both dlls, calls
>>> their factory functions and then passes each IModule instance that it
>>> got from factories to those modules.
>>>
>>> Modules then try to cast those IModule refs back to their real
>>> interfaces (ISharedModule1) but i am getting null there.
>>>
>>> A have found a workaround for this by returning a void* pointer to real
>>> interface and it back when needed.
>>>
>>> Another, and more major issue is, that when exception is thrown
>>> application fail immediately.
>>>
>>> Is it broken on windows, or it is me doing it wrong?
>>
>> Dlls are generally broken on windows. If you hack around in druntime
>> (e.g. the casting routines) you can get it to work to some degree, but
>> you are going to be happier if you just stay away from it.
>
> Is there a bugzilla issue for this? And what is the status of windows dlls?

Yes there is: https://issues.dlang.org/show_bug.cgi?id=9816
Also: http://wiki.dlang.org/DIP45

I'm currently working on it, but I can not promise anything. Also its 
unclear how long its going to take to get it merged once its actually 
working.

Kind Regards
Benjamin Thaut


More information about the Digitalmars-d mailing list