digitalmars.D - Help a newbie understand native D library versus Wrapped API calls
- Jorge C (22/22) May 14 2005 Hi! I'm a newbie so beware :(
- Jarrett Billingsley (18/23) May 14 2005 Well, the way most OSes do it (Windows included) is you have a bunch of
- Kevin Bealer (13/35) May 14 2005 A wrapper library is an interface to a library written in another langua...
Hi! I'm a newbie so beware :( When you create a new langauge like D how do you create the libraries to work with the operating system(For instance Windows) ? Do you create wrappers around the OS API or do you create assembly code to work with the Operating system? For instance : window management - What would you a D compatible library to work with the operating system window management system? Or would you create on your window management system? Confusing, right? :( I know.... Can any of you show me an example of what you be the perfect solution for the libraries problems? At the moment D isn't very useful for a newbie because it lacks libraries to work with the window management system, databases,etc. I don't understand what you folks mean when you say "native D library instead of a wrapper library"... Anyone cares to explain, give some links where can I find this info... My views: a native D library would be made in assembly code which would eventually call (respect) the operating system API.... I'm lost... Thanks for your help and attention. Jorge C.
May 14 2005
"Jorge C" <rdc02271 yahoo.com> wrote in message news:d6510s$18q7$1 digitaldaemon.com...When you create a new langauge like D how do you create the libraries to work with the operating system(For instance Windows) ? Do you create wrappers around the OS API or do you create assembly code to work with the Operating system?Well, the way most OSes do it (Windows included) is you have a bunch of header files and libraries. The header files define the names and parameters of all the functions, and the libraries contain references to the internal workings of the OS (in Windows, for example, I think it's called NTKERNEL). When you make a Windows program, you import the header files that you need. So say you need to access MessageBox(). You import the module that contains the MessageBox() function declaration, and you also tell the compiler to use the win32.lib library. When your program is compiled, it is turned into an object file, which has references to MessageBox(), but doesn't actually have the code. It is then linked with the win32.lib, which turns the MessageBox() references into actually valid calls to the internal Windows function called MessageBox(). There are already headers and libs for D for Windows and Linux. It comes with std.c.windows.windows and std.c.linux.linux. You'll have to set up your command line to include the appropriate OS library as well.
May 14 2005
In article <d6510s$18q7$1 digitaldaemon.com>, Jorge C says...Hi! I'm a newbie so beware :( When you create a new langauge like D how do you create the libraries to work with the operating system(For instance Windows) ? Do you create wrappers around the OS API or do you create assembly code to work with the Operating system? For instance : window management - What would you a D compatible library to work with the operating system window management system? Or would you create on your window management system? Confusing, right? :( I know.... Can any of you show me an example of what you be the perfect solution for the libraries problems? At the moment D isn't very useful for a newbie because it lacks libraries to work with the window management system, databases,etc. I don't understand what you folks mean when you say "native D library instead of a wrapper library"... Anyone cares to explain, give some links where can I find this info...A wrapper library is an interface to a library written in another language. If you have a C++ or C library you can write D interfaces to it. Many languages have this ability. In D, the method used to do this (as I understand it) is usually to write D function interfaces and then link to a C library that satisfies these functions.My views: a native D library would be made in assembly code which would eventually call (respect) the operating system API....Possible, but unlike Java, for example, that has trouble interfacing to the hardware, D can do most of this without ASM code. You can do most or all of what C can do when dealing with memory and hardware. KevinI'm lost... Thanks for your help and attention. Jorge C.P.S. I've found the "search" link at the top of the D front page to be very helpful. Kevin
May 14 2005