[En-Nut-Discussion] unix port & header files

Matthias Ringwald mringwal at inf.ethz.ch
Thu Mar 4 09:30:47 CET 2004


hi, I'd like to comment on my own mail.

the problem of basically can be compressed to a single question:

how should the compile distinguish between the nut/os version
of fopen and the native fopen call.

If the nut/os version is needed (let's say, using the ppp implementation
on top of an RFCOMM bluetooth connections... :) I cannot remove any of 
them.

So, is there a way to tell the compiler which version I refer to?
I remember seeing something with "namespace" in c or c++ apps,
but don't know this exaclty.
If something like this is not possible, then I guess adding
'Nut' to any function that resembles native functions by
adding

#ifdef NUT_UNIX_EMULATION
#define OS_CALLS_PREFIX
#else
#define OS_CALLS_PREFIX NUT
#endif

and prefixing every nut/os functions definition
and call with it.

#define int OS_CALLS_PREFIX_fopen ( ... )

.. handle = OS_CALLS_PREFIX_fopen ( ... )

ugly...

some idea?

matthias ringwald




On 03.03.2004, at 19:47, Matthias Ringwald wrote:

> hi
>
> I'm trying to run nut/os on top of a unix system right now.
> I started by inserting tons of "#ifndef NUT_UNIX_EMULATION" until the 
> os folder did compile.
> Now I tried to compile the threads example. I'm able to compile this.
>
> but I run into problems, because I have duplicate header files
> - the nut/os ones and the native system ones.
>
> sometimes it works, but the problem starts when they get mixed up.
>
> example: in thread.c I tried to add #include <pthread.h> which
> includes some other headers, which are taken also from nut/os
> right now, I can't see the which one is causing trouble.
>
> I guess my/the general problem is clear:
> I shouldn't mix header files.
>
> Any suggestions to solve this?
>
> I guess I should remove all nut/os files that are available natively 
> and
> move all definitions that are needed to other files.
>
> Other ideas?
>
> thanks,
> matthias ringwald
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion




More information about the En-Nut-Discussion mailing list