Questions about D

FireLancer FireLancer at yahoo.com
Fri May 23 07:52:23 PDT 2008


Jarrett Billingsley Wrote:

> "Bill Baxter" <dnewsgroup at billbaxter.com> wrote in message 
> news:g14r0u$nf0$1 at digitalmars.com...
> 
> > Maybe it's supposed to have that effect, but currently at least it does 
> > not insulate you from namespace clashes.  Wasn't that how this 
> > conversation began?
> 
> But if you make a symbol private, build it as a lib, and export the .di, the 
> private symbol should not appear in the .di file. 
> 
> 

So in D it only looks at what is defined in the .di file unlike c++ which goes to the lib it's self (I'd assume the linker looks there?) to see whats there and thus finds functions you did not want to be avaible externaly and clashes.

So I can have a function that avaible within the static lib but not ouside the lib using .di files?

eg say sound.d and music.d use functions from in audio.d to build a static libary audio.lib

If I only put the functions from sound.d and music.d into a .di file then the user only sees those not the underlying functions that make it work and also if the user creats a function with the same name as one of these "hidden" functions say "CreateSecondaryBuffer()" they won't get linker errors.


More information about the Digitalmars-d-learn mailing list