socketvar.h
socketvar.h
- Subject: socketvar.h
- From: Eric Long <email@hidden>
- Date: Fri, 03 Jan 2003 12:39:10 -0800
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.
So, I have a header that looks something like this:
#ifdef __cplusplus
extern "C" {
#endif
struct sockbuf;
int foo( struct sockbuf *sb );
#ifdef __cplusplus
}
#endif
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
int foo(struct sockbuf *sb )
{
...do something with sb
}
} // extern "C"
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
_______________________________________________
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.