additional question from "memcpy, strlen etc."
Stefan Kalkowski
stefan.kalkowski at ...1...
Fri Jan 29 12:50:37 CET 2010
Hello,
On Friday, 29. January 2010 10:32:25 Frank Kaiser wrote:
> There is an implementation of some of these functions callable by C code
> in base/src/base/cxx/misc.cc which becomes part of cxx.lib.a, but I
> don't see a C header file which exports the interfaces.
Well, in fact we use the c++ support library provided by the gcc-compiler, you
compile Genode with, because it contains a lot of gcc-specific code esp. for
exception handling. The c++ support library contains a few unresolved symbols
like "memcpy", "malloc", "abort" etc. your system needs to provide. This is
what is implemented in "base/src/base/cxx/*". The cxx.lib.a library contains
the gcc support library linked against these few functions. Moreover, we hide
the symbols of these typical c-library functions to not clash with a fully
implemented c-library used on top of the basic Genode primitives, e.g. the
libc repository in Genode.
Naturally, as you can't use these symbols outside of the library, it makes not
sense and is even not wanted to provide header files to these functions.
> Depending on the
> target setup the compiler either takes the header file(s) from itself
> (system) or from Genode's libc, but the implementation is taken from the
> cxx library (since it appears in the LIBS list of all targets). I'd
> prefer to have header files which are created from the sources they are
> referring to instead of taking them from elsewhere (although I admit
> that prototypes of memcpy() or printf() should be the same on most
> systems).
The compiler doesn't use any header files at this point, it simply binds the
unresolved symbols of gcc's c++ support library with the compiled code of our
provided functions in "base/src/base/cxx/*". There are no header files
(outside the Genode tree) involved.
To use c-library code you should link your application against Genode's "libc"
(like Norman recommended before).
Kind regards,
Stefan
>
>
>
> Frank
>
> > -----Original Message-----
> >
> > From: Norman Feske [mailto:norman.feske at ...1...]
> >
> > Sent: Friday, January 22, 2010 8:47 AM
> >
> > To: Genode OS Framework Mailing List
> >
> > Subject: Re: additional question from "memcpy, strlen etc."
> >
> >
> >
> > Hi Peter,
> >
> > > As an addition to the previous post by me, I have some pre-existing
>
> C code
>
> > that
> >
> > > I want to use in a Genode server I have created, and I don't really
>
> want to
>
> > > change this code. Currently, i'm not able to utilize functions like
>
> printf,
>
> > > memcpy etc in the C code i've written. What header files can I
>
> include to
>
> > ensure
> >
> > > that functions like memcpy and printf work in my code? From what I
>
> can see,
>
> > the
> >
> > > build process does not recognize the standard header files at all.
> >
> > the functionality you are referring to is provided by the C library.
> >
> > Just include the 'libc' repository to the 'REPOSITORIES' declaration
> >
> > of your '<builddir>/etc/build.conf'. This way, Genode's build system
> >
> > will incorporate the C library into the build process. For using the
> >
> > C library for your program, you need to add 'libc' to the 'LIBS' of
> >
> > your 'target.mk' file. For more information, please refer to
> >
> > 'libc/README'.
> >
> >
> >
> > Norman
>
> ------------------------------------------------------------------------
> ------
>
> > Throughout its 18-year history, RSA Conference consistently attracts
>
> the
>
> > world's best and brightest in the field, creating opportunities for
>
> Conference
>
> > attendees to learn about information security's most important issues
>
> through
>
> > interactions with peers, luminaries and emerging and established
>
> companies.
>
> > http://p.sf.net/sfu/rsaconf-dev2dev
> >
> > _______________________________________________
> >
> > Genode-main mailing list
> >
> > Genode-main at lists.sourceforge.net
> >
> > https://lists.sourceforge.net/lists/listinfo/genode-main
--
Stefan Kalkowski
Genode Labs Developer
http://genode-labs.com
More information about the users
mailing list