FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Lending a hand

 
Post new topic   Reply to topic     Forum Index -> DDL - D Dynamic Libraries
View previous topic :: View next topic  
Author Message
kylefurlong



Joined: 16 Nov 2005
Posts: 29

PostPosted: Thu Jan 05, 2006 7:45 pm    Post subject: Lending a hand Reply with quote

How can I help you Eric? I have some free time to burn. Laughing
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Fri Jan 06, 2006 9:01 am    Post subject: Reply with quote

Kyle, thank you for volunteering!

I think a lot of the heavy-duty parts are pretty much spoken for in this iteration, but that doesn't mean we're done. We're pretty much done with the high level design, and now its just down to implementation:

Lars: ELF/Archive loading
Myself: Zip and Path loading (plus COFF refactoring)

Also, the refactoring task tickets are going to pretty much fall into place after these bits are done.

But there's still more to be done!


    - I've decided to use the wiki for documentation, so we can all contribute. Since we're starting to build up interest, a tutorial and FAQ sections are the best way to get folks moving so they can contribute more readily. Feel free to augment of complete either of these sections:

    http://trac.dsource.org/projects/ddl/wiki/Tutorial
    http://trac.dsource.org/projects/ddl/wiki/FAQ

    These are just starting points. I'll see about redoing the main wiki page and developing some kind of master index so these pages aren't just floating out there.

    - Are you a Linux guy? I have a concern regarding the in-situ symbol loading process outside of DMD. Will Linux need its own map file parser, or is there some other (os specific) mechanism we can use instead?

    - I could use another pair of eyes to critique the overall design, to make sure we didn't miss anything obvious. Sort of a quality check of the library.

    - If you're not interested in getting up to your elbows in the internals of this thing, you can always test the software. I seriously need someone to pound the bejeezus out of this library, and make sure that it doesn't present any usability issues; I want a clean interface on this thing.

    - If you are interested, I'm also curious as to how it stands up to aggressive garbage collection and what its memory usage profile looks like.

    - Brainstorming: Can you think of anything you'd like to see in V2.0? How about anything that fits the design of V1.0?

_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Fri Jan 06, 2006 12:06 pm    Post subject: Reply with quote

pragma wrote:

- Are you a Linux guy? I have a concern regarding the in-situ symbol loading process outside of DMD. Will Linux need its own map file parser, or is there some other (os specific) mechanism we can use instead?


If you are a linux guy, I wouldn't mind hearing some opinions as things move along. At the moment I'm trying to get a better understanding of the latter parts of the ELF spec. As for the in-situ stuff, I might be able to understand that at some point, but I have some difficulties understanding the concept (as the word itself, in-situ, says absolutely nothing to me) as something different than the dynamic linker itself. There, now you see what you got onboard Wink
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Fri Jan 06, 2006 12:21 pm    Post subject: Reply with quote

larsivi wrote:
As for the in-situ stuff, I might be able to understand that at some point, but I have some difficulties understanding the concept (as the word itself, in-situ, says absolutely nothing to me) as something different than the dynamic linker itself. There, now you see what you got onboard Wink


My apologies Lars, Kyle. This might help:

Quote:

in si·tu (n st)
adj.

1. In the original position.
2. Confined to the site of origin.

(definition provided just in case - I know we're all fairly bright guys around here. Wink )

The in situ portion of DDL refers to the symbols that are present "in the original position" with respect to the .exe portion of your program. The whole process relies on the fact that the .map file spells out what the memory location is for every symbol in the .exe. The InSitu loader takes this name and address data and simply throws it into a DynamicModule object. That object is then made it available the rest of DDL: no fixups are performed because again, everything stays put.

Without the InSitu loader, the only remaining option for developers using DDL would be to bootstrap their entire application as a .ddl (so 100? of the app's symbol information is exposed) - much like Java does via its VM.
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Fri Jan 06, 2006 1:49 pm    Post subject: Reply with quote

pragma wrote:
larsivi wrote:
As for the in-situ stuff, I might be able to understand that at some point, but I have some difficulties understanding the concept (as the word itself, in-situ, says absolutely nothing to me) as something different than the dynamic linker itself. There, now you see what you got onboard Wink


My apologies Lars, Kyle. This might help:

Quote:

in si·tu (n st)
adj.

1. In the original position.
2. Confined to the site of origin.

(definition provided just in case - I know we're all fairly bright guys around here. Wink )

The in situ portion of DDL refers to the symbols that are present "in the original position" with respect to the .exe portion of your program. The whole process relies on the fact that the .map file spells out what the memory location is for every symbol in the .exe. The InSitu loader takes this name and address data and simply throws it into a DynamicModule object. That object is then made it available the rest of DDL: no fixups are performed because again, everything stays put.

Without the InSitu loader, the only remaining option for developers using DDL would be to bootstrap their entire application as a .ddl (so 100? of the app's symbol information is exposed) - much like Java does via its VM.


Thanks for the explanations Smile

Now over to Linux and In-situ loading (just shortly, as to not require another thread): I think (still haven't read the whole ELF-spec..) that an ELF-file can take on all necessary forms through all the "life" stages of a program: compiled object code, linked executables and linked dynamic libraries. If you hold DDL out of the picture, ELF-object files are linked together using the link editor (ld), then to use a dynamic library, you use the dynamic linker (dl). And since both of these processes are described in the spec, I suppose it's all catered for. I will get back to this when I'm ready in any case.
Back to top
View user's profile Send private message
kylefurlong



Joined: 16 Nov 2005
Posts: 29

PostPosted: Sat Jan 07, 2006 9:45 pm    Post subject: Reply with quote

Edit: In answer to the above, I am not a linux person.

I figure if I'm gonna help I'd better understand how to use it!

Code:

/****************************************
   DDLTest.d - Testing of DDL metrics
****************************************/
module ddltest;

import ddl.all;

int sum(int a, int b)
{
   return a+b;
}

int main()
{
   auto linker = new Linker(new DefaultRegistry());
   linker.loadAndRegister("/dmd/lib/phobos.lib");
   linker.loadAndRegister("/dm/lib/snn.lib");
   
   auto testLibrary = linker.loadAndLink("DDLTest.obj");
   
   auto sum = testLibrary.getDExport!(int function(int, int),"ddltest.sum")();   
   assert(sum(1,2) == 3);
   return 0;
}   


This chokes on GetStringTypeA? Let me know what I am doing wrong. Wink
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Sun Jan 08, 2006 5:10 am    Post subject: Reply with quote

Looks like you forgot the in situ module. Be sure to coerce optlink to create a full map file like so:

Code:
build ddltest -L" -map"


Now if all you're doing is local reflection & loading, then the in situ library (map file) is the only one you need.

Code:

   auto linker = new Linker(new DefaultRegistry());
   linker.loadAndRegister("/dmd/lib/ddltest.map");
   auto testLibrary = linker.loadAndLink("DDLTest.obj");


Phobos.lib and Snn.lib are brought in only if you're loading external libraries that may have dependencies that aren't already compiled into your .exe. Smile
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Sun Jan 08, 2006 5:10 am    Post subject: Reply with quote

Looks like you forgot the in situ module. Be sure to coerce optlink to create a full map file like so:

Code:
build ddltest -L" -map"


Now if all you're doing is local reflection & loading, then the in situ library (map file) is the only one you need.

Code:

   auto linker = new Linker(new DefaultRegistry());
   linker.loadAndRegister("/dmd/lib/ddltest.map");
   auto testLibrary = linker.loadAndLink("DDLTest.obj");


Phobos.lib and Snn.lib are brought in only if you're loading external libraries that may have dependencies that aren't already compiled into your .exe. Smile
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DDL - D Dynamic Libraries All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group