Questions about D

FireLancer FireLancer at
Thu May 22 08:49:56 PDT 2008

Ive been learning c++ and was wondering if I should move over to D or not but theres a few details I'm not sure on and I couldn't find a good ansew on.

1)Is there a way to "hide" things complelty when building a static libary. eg in c++ if I have:

double GetRandomNumber();

int DoSomething()
 //do something
double GetRandomNumber()
     return (double)rand() / RAND_MAX;

This is fine as the user doesn't know DoSomething() exists. But now if they create there own DoSomething() they get linker errors because it exists twice :(

Also if I built a frame work based off of DirectX and Win32 API it's be nice to complelty hide functions from those unless the user imported them themselves. (So for them CreateWindow() doesn't exist UNLESS they imported the windows files themselves even though it's used in my libary)
I couldn't tell if D has an eqivlent to the STL. I can see that maps are built in but what of std::set and std::list?

How do I go about using DirectX with D as all the headers are c/c++

Do the varible sizes work as in c or are they fixed?
eg in c I could define them as

char - at least one byte
short - at least as large as a char
int - at least as large as a short
long - at least as large as an int 

But it would be nice if they were fixed eg
char - 1 byte
short - 2 bytes
int - 4 bytes
long - 8 bytes


More information about the Digitalmars-d-learn mailing list