www.digitalmars.com         C & C++   DMDScript  

D - Distributing binary D libraries without source code

reply Damon Gray <Damon_member pathlink.com> writes:
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.
Jan 05 2004
next sibling parent reply "Matthew" <matthew.hat stlsoft.dot.org> writes:
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

 and I can't understand how you would distribute a binary library for a D

 without giving out it's source. For example, lets say I wanted to release

 module  that does some nifty text manipulations, lets call it module

 and the file is nifty.d. I compile this and want to create a libnifty.a.

 that. Then it seems to me if I want anyone to be able to use libnifty in

 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

 library and send it out with a .h file and they would get the definitions

 that.

 Thanks for helping this new D explorer.

Jan 05 2004
next sibling parent reply J Anderson <REMOVEanderson badmama.com.au> writes:
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 ...

  

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
Jan 05 2004
next sibling parent reply "Matthew" <matthew.hat stlsoft.dot.org> writes:
"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


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 ...

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.
Jan 06 2004
parent J Anderson <REMOVEanderson badmama.com.au> writes:
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
      


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 ...



      

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.

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.

you use doxygen. Personally for something like intellisense, appart from performace issues, doxygen would be overkill. Anderson
Jan 06 2004
prev sibling parent J C Calvarese <jcc7 cox.net> writes:
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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 ...

  

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/
Jan 06 2004
prev sibling parent Marco A <Marco_member pathlink.com> writes:
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

 and I can't understand how you would distribute a binary library for a D

 without giving out it's source. For example, lets say I wanted to release

 module  that does some nifty text manipulations, lets call it module

 and the file is nifty.d. I compile this and want to create a libnifty.a.

 that. Then it seems to me if I want anyone to be able to use libnifty in

 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

 library and send it out with a .h file and they would get the definitions

 that.

 Thanks for helping this new D explorer.


Jan 06 2004
prev sibling parent Andy Friesen <andy ikagames.com> writes:
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
Jan 05 2004