On Wed, Jul 06, 2005 at 01:15:33AM -0700, Wolfram Arnold wrote:
> Could the macro be split into two or take an extra flag to optionally
> not generate the definition for the globals? I'd be glad to give this a
> shot, but I wanted to hear from the community if there is any reason
> other than lack of volunteers. This has come up before; I found mailing
> list articles as far back as 2001 on this.
Personally, I'd say go for it. Keeping all the logic in one macro / header
(i.e. custom-macros.h) is probably the most maintenance friendly, since the
macro needs to be expanded for the names anyway, and you don't want to
duplicate it anywhere.
Something like this might be useful:
// file: tables.h - define it
sql_create_5(stock, ..... );
// file: stock.cpp - the only file that has the static data
#define SSQLS_GENERATE_STATICS
#include "tables.h"
// file: client.cpp - simple user module
#include "tables.h"
Might take some creativity to do that, but I think it's possible.
- Chris