www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - how to... make a D library and distribute?

reply John Love-Jensen <John_member pathlink.com> writes:
I want to send out a D library (.lib) I made to a friend.

With Java and Java's .jar files, he can link them right into his project and
everything works.

With D Programming Language, do I have to make a "header" file to distribute
with my D library?

If so, I thought D was supposed to get away from needing header files?

And if so, is there a way to automatically generate the tandem D "header" file
for the distributed library?

Thanks,
--Eljay
Sep 12 2005
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"John Love-Jensen" <John_member pathlink.com> wrote in message 
news:dg4jri$27qq$1 digitaldaemon.com...
I want to send out a D library (.lib) I made to a friend.

 With Java and Java's .jar files, he can link them right into his project 
 and
 everything works.

 With D Programming Language, do I have to make a "header" file to 
 distribute
 with my D library?

Yep.
 If so, I thought D was supposed to get away from needing header files?

There are several threads about this. Some people are working on ways to implicity import functions, classes etc. from .lib files.
 And if so, is there a way to automatically generate the tandem D "header" 
 file
 for the distributed library?

I think Derek Parnell is working on putting this functionality into his "build" utility. I've also been meaning to make a tool to do just this (as I have run into the same problem), but I haven't had much time.
Sep 12 2005
prev sibling next sibling parent John Reimer <terminal.node gmail.com> writes:
John Love-Jensen wrote:
 I want to send out a D library (.lib) I made to a friend.
 
 With Java and Java's .jar files, he can link them right into his project and
 everything works.
 
 With D Programming Language, do I have to make a "header" file to distribute
 with my D library?
 
 If so, I thought D was supposed to get away from needing header files?
 
 And if so, is there a way to automatically generate the tandem D "header" file
 for the distributed library?
 
 Thanks,
 --Eljay
 
 

There has been a few topics reviewing the need for a headerless D in the digitalmars.d newsgroup. You might like to have a look there. Currently, you do need to provide an D "header" (aka stripped import module of your project source) with your D library (.lib). I believe digc (see the undig project at dsource.org) does this sort of thing already. Burton created digc as part of his dig project a few years ago. I don't know if it still works now. The reason you keep hearing about D's ability to operate headerlessly is because that feature used to be frequently advertised as a an advantage of the language. The only problem is that such a feature is still absent from all current d tools, though technically feasible and certainly much anticipated by everyone here. As of now, the project that shows the most promise in this area is Eric's DDL project over at dsource.org. It looks like he's making tremendous headway. Keep on eye on that one if your interested in seeing D gain a feature that may single handedly propel D into super-stardom status ;-). -JJR
Sep 12 2005
prev sibling parent John Love-Jensen <love-jensen mchsi.com> writes:
Hi John & Jarrett,

Thanks for the info!

I was concerned that I was missing something fundamental.

Great to hear there are several different strategies being tested to 
resolve the issue!

Sincerely,
--Eljay
Sep 12 2005