Quiz of the day: Why does this not work?
TomD
t_demmer at nospam.web.de
Thu Nov 6 20:53:41 PST 2008
Jarrett Billingsley Wrote:
[...]
>
> DLLs are unusable. It's not actually D's fault, it's the fault of
> Microsoft using such a poorly-capable dynamic library loading system.
> Basically, the problem with DLLs is that they cannot load symbols from
> the "host" application at load-time. This means that information
> contained in the host is not available to the DLL unless the host
> passes that data to the DLL after it has been loaded. In the case of
> D, there is type info embedded into your applications and libraries
> that is required for things like class casting (as you've seen here)
> to work correctly. What happens currently is that when you build your
> application and then you build the DLL, they each end up _with their
> own copies of the same type info_, meaning that even though a "host"
> c1 is the same thing as a DLL c1, they are in effect two different
> classes as they have two different type infos.
>
Understood. I have seen a similar (or, as I realize now: the
same) problem on Cygwin, where you have the need to resolve
externals at link time, not at load time.
> The way around this? Don't use DLLs. Use DDLs.
> http://www.dsource.org/projects/ddl
Last time I tried that I did not manage to get that running,
but I'll try harder.
Thanks for all the help and insight,
Ciao
Tom
More information about the Digitalmars-d
mailing list