On 2015-05-27 23:24, bitwise wrote:

Good point.

I've come up another solution and posted it here:
http://dpaste.com/0DXBSNQ

BTW, I'm not sure what's the best solution but you can calculate the slide without iterating all images. Look at the first statements in "tlv_allocate_and_initialize_for_key" in [1]. Specifically where it sets the "slide" variable.

Basically, I've gone back to the idea of using the dylib ctor/dtors. I
don't think we really even need the image-added callback, at least not
for dylibs.

I callback could still be used when the main application is written in
D, but we could also replace it with my solution in the dpaste(the
getThisImageInfo function).

I think it would be simpler to only have one way to do this.

As far as TLS goes, I haven't looking into the details of actually
initializing the images yet. Once we have a solution for when and how to
initialize the dylibs, I'll move on to the specifics... pun intended ;)

Fair enough.

I think the solution above may be a winner though.

I agree, but I think ctor/dtors can be used for the executable as well.

[1] http://opensource.apple.com/source/dyld/dyld-353.2.1/src/threadLocalVariables.c

--
/Jacob Carlborg

Reply via email to