Thread overview
Distributing binary D libraries without source code
Jan 05, 2004
Damon Gray
Jan 05, 2004
Matthew
Jan 06, 2004
J Anderson
Jan 06, 2004
Matthew
Jan 06, 2004
J Anderson
Jan 07, 2004
J C Calvarese
Jan 07, 2004
Marco A
Jan 06, 2004
Andy Friesen
January 05, 2004
I'm probably missing something obvious. But I've read through the documentation and I can't understand how you would distribute a binary library for a D module without giving out it's source. For example, lets say I wanted to release a module  that does some nifty text manipulations, lets call it module text.nifty; and the file is nifty.d. I compile this and want to create a libnifty.a. So I do that. Then it seems to me if I want anyone to be able to use libnifty in their project I have to also give them nifty.d source file.

Is this correct?

Maybe I just can't get past my C eyes. :) To do this with C I would make the library and send it out with a .h file and they would get the definitions from that.

Thanks for helping this new D explorer.


January 05, 2004
Just strip out the function definitions, leaving the declarations in there.

This is something I'm hoping we can oblige Walter to include in the compiler, so if you add your voice to the heaving masses ...

"Damon Gray" <Damon_member@pathlink.com> wrote in message news:btcrqu$14du$1@digitaldaemon.com...
> I'm probably missing something obvious. But I've read through the
documentation
> and I can't understand how you would distribute a binary library for a D
module
> without giving out it's source. For example, lets say I wanted to release
a
> module  that does some nifty text manipulations, lets call it module
text.nifty;
> and the file is nifty.d. I compile this and want to create a libnifty.a.
So I do
> that. Then it seems to me if I want anyone to be able to use libnifty in
their
> project I have to also give them nifty.d source file.
>
> Is this correct?
>
> Maybe I just can't get past my C eyes. :) To do this with C I would make
the
> library and send it out with a .h file and they would get the definitions
from
> that.
>
> Thanks for helping this new D explorer.
>
>


January 06, 2004
Damon Gray wrote:

> I'm probably missing something obvious. But I've read through the documentation
> and I can't understand how you would distribute a binary library for a D module
> without giving out it's source. For example, lets say I wanted to release a
> module  that does some nifty text manipulations, lets call it module text.nifty;
> and the file is nifty.d. I compile this and want to create a libnifty.a. So I do
> that. Then it seems to me if I want anyone to be able to use libnifty in their
> project I have to also give them nifty.d source file.
> 
> Is this correct?
> 
> Maybe I just can't get past my C eyes. :) To do this with C I would make the
> library and send it out with a .h file and they would get the definitions from
> that.
> 
> Thanks for helping this new D explorer.

You just need to remove the function bodies in the source, and distribute that.  ie

class A
{
   void B();
}

void C();

digc does this automatically, I believe. (don't quote me on that)

 -- andy
January 06, 2004
Matthew wrote:

>Just strip out the function definitions, leaving the declarations in there.
>
>This is something I'm hoping we can oblige Walter to include in the
>compiler, so if you add your voice to the heaving masses ...
>
>  
>
Me to, if not in the compiler, a tool that comes with the compiler.  The sooner the "header" format is standardised, the better the chance of it being used for things like intellisense in editors.

In the mean time you could use doxygen (I'm not implying that the declaration format standard should be anything as complex as doxygen).

Anderson

January 06, 2004
"J Anderson" <REMOVEanderson@badmama.com.au> wrote in message news:btdggh$248n$1@digitaldaemon.com...
> Matthew wrote:
>
> >Just strip out the function definitions, leaving the declarations in
there.
> >
> >This is something I'm hoping we can oblige Walter to include in the compiler, so if you add your voice to the heaving masses ...
> >
> >
> >
> Me to, if not in the compiler, a tool that comes with the compiler.  The sooner the "header" format is standardised, the better the chance of it being used for things like intellisense in editors.

Indeed. This'd be easy to do. Someone with some time should have a go. I'm sure Walter would give the appropriate pointers.

> In the mean time you could use doxygen (I'm not implying that the declaration format standard should be anything as complex as doxygen).

I always Doxygenate my libs, but it's not used for Intellisense or anything.



January 06, 2004
inline

Matthew wrote:

>"J Anderson" <REMOVEanderson@badmama.com.au> wrote in message
>news:btdggh$248n$1@digitaldaemon.com...
>  
>
>>Matthew wrote:
>>
>>    
>>
>>>Just strip out the function definitions, leaving the declarations in
>>>      
>>>
>there.
>  
>
>>>This is something I'm hoping we can oblige Walter to include in the
>>>compiler, so if you add your voice to the heaving masses ...
>>>
>>>
>>>
>>>      
>>>
>>Me to, if not in the compiler, a tool that comes with the compiler.  The
>>sooner the "header" format is standardised, the better the chance of it
>>being used for things like intellisense in editors.
>>    
>>
>
>Indeed. This'd be easy to do. Someone with some time should have a go. I'm
>sure Walter would give the appropriate pointers.
>
>  
>
I suppose the advantage of having it in the compiler is that you would need to pharse the code less and it would be update tollerent.

>>In the mean time you could use doxygen (I'm not implying that the
>>declaration format standard should be anything as complex as doxygen).
>>    
>>
>
>I always Doxygenate my libs, but it's not used for Intellisense or anything.
>
>  
>
Actually this part was meant for Damon (I forgot to say that). I know you use doxygen.  Personally for something like intellisense, appart from performace issues, doxygen would be overkill.

Anderson

January 07, 2004
the Eiffel folks have a utility called "short" that does this type of thing since it is also a single source file language per "module/class"

In article <btct3d$16b9$2@digitaldaemon.com>, Matthew says...
>
>Just strip out the function definitions, leaving the declarations in there.
>
>This is something I'm hoping we can oblige Walter to include in the compiler, so if you add your voice to the heaving masses ...
>
>"Damon Gray" <Damon_member@pathlink.com> wrote in message news:btcrqu$14du$1@digitaldaemon.com...
>> I'm probably missing something obvious. But I've read through the
>documentation
>> and I can't understand how you would distribute a binary library for a D
>module
>> without giving out it's source. For example, lets say I wanted to release
>a
>> module  that does some nifty text manipulations, lets call it module
>text.nifty;
>> and the file is nifty.d. I compile this and want to create a libnifty.a.
>So I do
>> that. Then it seems to me if I want anyone to be able to use libnifty in
>their
>> project I have to also give them nifty.d source file.
>>
>> Is this correct?
>>
>> Maybe I just can't get past my C eyes. :) To do this with C I would make
>the
>> library and send it out with a .h file and they would get the definitions
>from
>> that.
>>
>> Thanks for helping this new D explorer.
>>
>>
>
>


January 07, 2004
J Anderson wrote:

> Matthew wrote:
> 
>> Just strip out the function definitions, leaving the declarations in there.
>>
>> This is something I'm hoping we can oblige Walter to include in the compiler, so if you add your voice to the heaving masses ...
>>
>> 
>>
> Me to, if not in the compiler, a tool that comes with the compiler.  The sooner the "header" format is standardised, the better the chance of it being used for things like intellisense in editors.
> 
> In the mean time you could use doxygen (I'm not implying that the declaration format standard should be anything as complex as doxygen).
> 
> Anderson
> 

It doesn't quite work these days, but strip.d in dig tries to strip D sources.  (Fortunately, strip.d doesn't depend on the rest of dig, since dig stopped compiling again with the advent of DMD 0.77.)

It compiles (and it somewhat works).  It might be easier to correct strip.d than to create a new program.  Anyways, I've attached the code for everyone's consideration.


-- 
Justin
http://jcc_7.tripod.com/d/