Re: socketvar.h
Re: socketvar.h
- Subject: Re: socketvar.h
- From: Brian Bergstrand <email@hidden>
- Date: Fri, 3 Jan 2003 16:30:44 -0600
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Friday, January 3, 2003, at 04:14 PM, Eric Long wrote:
>
> sockbuf is a kernel only structure, as should be evidenced by the
>
> KERNEL define wrapper. You can't expect to define KERNEL and have
>
> things work. Secondly, sockbuf is declared in the scope of the socket
>
> structure.
>
>
>
> IOW, if you aren't writing a kernel extension, don't even attempt to
>
> use the sockbuf (or socket) structure.
>
>
I am writing a kernel extension. The #ifdef KERNEL thing is comes
>
from what
>
I saw in the source example I am drawing from.
>
Okay, sorry. The KERNEL define is unusual and it threw me off into
thinking you were writing something in userland and trying to force a
kernel structure to work. Usually, KERNEL is defined by PB or your
Makefile.
>
Regarding scope...
>
>
This is the part that is a bit confusing to me. I never define a
>
struct
>
within a struct like this header does.
>
>
How should a forward declaration for this be declared?
>
>
I am able to work with the declare sockbuf* paramaeters in C
>
implementation
>
files with no complications. I don't know what the compiler is
>
looking for
>
when I try to do the same in a C++ file.
>
Well, it probably has to do with C++ treating structs as classes (with
implicit public access instead of implicit private access).
So in C++, the sockbuf struct (class) is declared in the socket struct
namespace and will only work from within that namespace.
C has one namespace (well, really two) and so everything is global in
C. This is not true in C++.
Maybe something like "socket::sockbuf" would work? Don't know for sure.
HTH.
>
>
Eric Long
>
Brian Bergstrand
<
http://www.classicalguitar.net/brian/> PGP Key ID: 0xB6C7B6A2
My code has no bugs, only random new features.
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPhYBCXnR2Fu2x7aiEQILggCg3FLrDm6iCdH8LL3A1sr4Ep59WTQAoP9K
8L/WeOYrWEL9gwzKjOsIim4V
=26b4
-----END PGP SIGNATURE-----
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.