Original Post
I've been working on a library and game in C and Python. I'm hoping to release the library sometime and I'm trying to figure out a flexible method of supporting namespaces so users won't have name clashing problems. One solution I'm considering is wrapping my global functions in a macro that prefixes them with the namespace. This way, the namespace can be changed if necessary. Anyways, here's the concept:It involves writing CORE_WRAP(...) around everything I export from the library including both functions and types. I've been using it for the python wrapper (edit: this is C code I'm referring to) around the library and it definitely reduces readability so I'm not sure if I like it. So before I go in and start wrapping all my functions via copy/paste, is this a "Good Idea"? [Edited by - dcosborn on October 30, 2004 10:41:36 PM]
// _config.h
#ifndef CORE_NAMESPACE
#define CORE_NAMESPACE core_
#endif
#define CORE_WRAP(a) CORE_NAMESPACE##a