Java > Scala
Jacob Carlborg
doob at me.com
Wed Nov 30 09:36:23 PST 2011
On 2011-11-30 16:36, Martin Nowak wrote:
> On Wed, 30 Nov 2011 09:19:59 +0100, Walter Bright
> <newshound2 at digitalmars.com> wrote:
>
>> On 11/29/2011 11:46 PM, Jacob Carlborg wrote:
>>> I agree. The shared library problem is blocked by DMD not being able to
>>> correctly generate PIC.
>>
>> The compiler does correctly generate PIC code on Linux. The problem is
>> nobody has figured out the details of making Phobos/Druntime a shared
>> library.
>>
>> I.e. there's more to creating a shared library than throwing -fPIC.
>
> I just had a look at creating shared libraries yesterday.
> The dynamic loader was complaining about some unsupported
> relocations (R_X86_64_32 with fPIC).
>
> What are the known remaining issues?
>
> I was also wondering whether using the gc_proxy is the best decision for
> Windows.
> On POSIX the GC symbols can be left undefined in the shared library
> and are resolved by the dynamic loader.
> The module infos could be added to a global list during _init and
> removed during _fini. This approach works for runtime loading as well
> as for linking to shared libs.
>
> martin
We also need make the runtime aware of module infos from libraries (and
some other data) when they're dynamically loaded, i.e. via dlopen. This
is quite easy on Mac OS X using the "_dyld_register_func_for_add_image"
function. I have no idea how to do the same on Linux or FreeBSD.
I'm pretty sure the compiler needs to generate different code for TLS
when the variable to access is in a dynamic library. There are couple of
different models available for TLS, I don't fully understand all the
differences.
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/dyld.3.html
http://www.akkadia.org/drepper/tls.pdf
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list