Re: Help a newbie understand how to create a "native library" for any new language

"Skandinavisches Seminar" <skandgoe@gwdg.de>
14 May 2005 22:00:04 -0400

          From comp.compilers

Related articles
Help a newbie understand how to create a "native library" for any new rdc02271@yahoo.com (rdc02271) (2005-05-14)
Re: Help a newbie understand how to create a "native library" for any haberg@math.su.se (2005-05-14)
Re: Help a newbie understand how to create a "native library" for any skandgoe@gwdg.de (Skandinavisches Seminar) (2005-05-14)
Re: Help a newbie understand how to create a "native library" for any haberg@math.su.se (2005-05-15)
| List of all articles for this month |
From: "Skandinavisches Seminar" <skandgoe@gwdg.de>
Newsgroups: comp.compilers
Date: 14 May 2005 22:00:04 -0400
Organization: GWDG, Goettingen
References: 05-05-093
Keywords: code
Posted-Date: 14 May 2005 22:00:03 EDT

"rdc02271" <rdc02271@yahoo.com> schrieb im Newsbeitrag
>
> Can any of you show me an example of what would be the perfect
> solution for the libraries problems?


Sorry, there's usually no such thing as a perfect solution.


I recommend the book _Linkers and Loaders_ by John R. Levine (the
moderator of this newsgroup) and the documentation of GNU Libtool:
http://www.gnu.org/software/libtool/libtool.html. You might want to
take a look at the relevant chapters in Kernighan and Ritchie, _The C
Programming Language_ and Stroustrup, _The C++ Programming Language_.
This will give you a clearer idea of what libraries are. You could
also take a look at the source code of the GNU implementations of the
C and C++ standard libraries.


Generally speaking, a library for C will be written in C, a library
for C++ in C++, etc. Assembler is platform-specific, so it's not a
good choice for code that's intended to be ported to other systems.
It's best suited for platform-specific optimizations, not for large
programming tasks.


> When you create a new langauge like D how do you create the
> libraries to work with the operating system (for instance Windows) ?


I can't help you with Windows, but in Unix-like systems, the operating
system provides so-called "system calls" in order to make it possible
for programs to communicate with the operating system.
Implementations of C provide functions that map to these system calls,
so that programmers can access them from their programs. 'creat',
'fork', 'exec', 'read' and 'write' are such system calls. The C
standard does not specify what they do, since they may differ from
system to system.


Laurence Finston


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.