[cfe-dev] add namespaces to C (in my local clang) OR "tag" a couple of functions

Don Quixote de la Mancha quixote at dulcineatech.com
Fri Oct 21 00:43:14 PDT 2011

On Fri, Oct 21, 2011 at 12:33 AM, Jonas Gefele <llvm.org at schrieb.de> wrote:
> (In my local clang copy) I would like to add namespace support to C. I
> want to use it to "tag" a couple of functions like this:
> namespace tag1 {

> (In my local clang copy) I need the ability to "tag" a bunch of C/C++
> functions/globals with some "name". Something like:

Would it work to just compile your C sources with a C++ compiler?

/* Foo.c

#ifdef __cplusplus
extern "C" {

#include "Foo.h"  /* These function names will not be mangled */

#ifdef __cplusplus

#ifdef __cplusplus
namespace tag1{

void foo( int bar )


#ifdef __cplusplus
} /* namespace tag1 */

Some creative macro definitions could make that look less ugly.

Don Quixote de la Mancha
Dulcinea Technologies Corporation
Software of Elegance and Beauty
quixote at dulcineatech.com

More information about the cfe-dev mailing list