Re: socketvar.h
Re: socketvar.h
- Subject: Re: socketvar.h
- From: Brian Bergstrand <email@hidden>
- Date: Fri, 3 Jan 2003 16:02:52 -0600
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Friday, January 3, 2003, at 02:39 PM, Eric Long wrote:
>
This is probably simple, but I haven't encountered this problem before
>
and
>
its not clear to me why I'm getting this problem...
>
>
I want to create a function that accepts as an argument a sockbuf*.
>
The
>
function is implemented in a C++ file, but is declared in a header
>
available
>
to call from a C file.
>
>
And a C++ source file that looks something like this:
>
>
extern "C" {
>
>
#ifndef KERNEL
>
#define KERNEL
>
#include <sys/socketvar.h>
>
#undef KERNEL
>
#else
>
#include <sys/socketvar.h>
>
#endif
>
>
When I attempt to build, I get error messages like this:
>
>
> foo.h:10: forward declaration of `struct sockbuf'
>
> foo.cp:20: invalid use of undefined type `struct sockbuf'
>
>
>
>
The puzzle is if I modify the above "example" to reference a socket
>
and not
>
a sockbuf, I get no compilation errors.
>
>
How do declare these properly so I can just use a sockbuf?
>
>
Thanks in advance,
>
>
Eric Long
>
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.
Brian Bergstrand
<
http://www.classicalguitar.net/brian/> PGP Key ID: 0xB6C7B6A2
Punctuality is the virtue of the bored. - Evelyn Waug
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPhX6gnnR2Fu2x7aiEQJeMwCggDxUEUCpP1sCZ59NknVpExc8xz8Anig/
NSie6qkYZBEj8Lq0jXNwG9qt
=LbYj
-----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.
References: | |
| >socketvar.h (From: Eric Long <email@hidden>) |