I've created a C header for C++ static-linked library foo.h
, which looks like this:
#ifndef __FOO_H__
#define __FOO_H__
const size_t SOME_CONST = 22;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
unsigned long foo();
...
void bar();
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __FOO_H__ */
I wanted to put it in some namespace in other header cfoo
. I've written this:
#ifndef __CFOO__
#define __CFOO__
namespace foo {
#include "foo.h"
}
#endif /* __CFOO__ */
GCC shows no errors and as I test, everything looks ok, but I am still not sure if this is a proper way to create this namespace. Can anybody confirm if this is a good way to do it, or maybe have some suggestions to do it better?