
Probably OT, but I'm trying to generate modules programmatically. Each module with be generated using -DSIMCASE=n and will create a module called ldpc_n.so. I can't get this macro to work, this is my latest try: #define SIMCASE 10 #define NAME ldpc_ ## SIMCASE #define MODULE_START BOOST_PYTHON_MODULE (NAME) Later I have: MODULE_START { ... } Results in: In file included from ldpc_x.cc:12: ldpc.cc: In function 'void initldpc_SIMCASE()': ldpc.cc:100: error: 'init_module_ldpc_SIMCASE' was not declared in this scope Looks like 2 problems there: 1 is that 'SIMCASE' did not have it's #defined value substituted, second is that (as evidenced by the error) this interacted wierdly with the BOOST_PYTHON_MODULE macro.

Neal Becker
Probably OT, but I'm trying to generate modules programmatically. Each module with be generated using -DSIMCASE=n and will create a module called ldpc_n.so.
I can't get this macro to work, this is my latest try:
#define SIMCASE 10 #define NAME ldpc_ ## SIMCASE #define MODULE_START BOOST_PYTHON_MODULE (NAME)
Later I have: MODULE_START { ... }
BOOST_PYTHON_MODULE is poorly written. It does not use BOOST_JOIN where it supposed to. I ended up rewriting it for our code. Gennadiy

Gennadiy Rozental wrote:
Neal Becker
writes: Probably OT, but I'm trying to generate modules programmatically. Each module with be generated using -DSIMCASE=n and will create a module called ldpc_n.so.
I can't get this macro to work, this is my latest try:
#define SIMCASE 10 #define NAME ldpc_ ## SIMCASE #define MODULE_START BOOST_PYTHON_MODULE (NAME)
Later I have: MODULE_START { ... }
BOOST_PYTHON_MODULE is poorly written. It does not use BOOST_JOIN where it supposed to. I ended up rewriting it for our code.
Perhaps, but it sounds like he could avoid this particular problem with the change #define NAME BOOST_JOIN(ldpc_, SIMCASE) Then again, I don't know much macro programming, and never heard of BOOST_JOIN before. -- Anthony Foglia Princeton Consultants (609) 987-8787 x233

Anthony Foglia wrote:
Gennadiy Rozental wrote:
Neal Becker
writes: Probably OT, but I'm trying to generate modules programmatically. Each module with be generated using -DSIMCASE=n and will create a module called ldpc_n.so.
I can't get this macro to work, this is my latest try:
#define SIMCASE 10 #define NAME ldpc_ ## SIMCASE #define MODULE_START BOOST_PYTHON_MODULE (NAME)
Later I have: MODULE_START { ... }
BOOST_PYTHON_MODULE is poorly written. It does not use BOOST_JOIN where it supposed to. I ended up rewriting it for our code.
Perhaps, but it sounds like he could avoid this particular problem with the change
#define NAME BOOST_JOIN(ldpc_, SIMCASE)
Then again, I don't know much macro programming, and never heard of BOOST_JOIN before.
Thanks for the pointer, I tried this: #define NAME BOOST_JOIN(ldpc_, SIMCASE) BOOST_PYTHON_MODULE (NAME) { I got: ldpc.cc: In function 'void initldpc_0()': ldpc.cc:102: error: 'init_module_ldpc_0' was not declared in this scope

Neal Becker wrote:
Anthony Foglia wrote:
Gennadiy Rozental wrote:
Neal Becker
writes: Probably OT, but I'm trying to generate modules programmatically. Each module with be generated using -DSIMCASE=n and will create a module called ldpc_n.so.
I can't get this macro to work, this is my latest try:
#define SIMCASE 10 #define NAME ldpc_ ## SIMCASE #define MODULE_START BOOST_PYTHON_MODULE (NAME)
Later I have: MODULE_START { ... }
BOOST_PYTHON_MODULE is poorly written. It does not use BOOST_JOIN where it supposed to. I ended up rewriting it for our code.
Perhaps, but it sounds like he could avoid this particular problem with the change
#define NAME BOOST_JOIN(ldpc_, SIMCASE)
Then again, I don't know much macro programming, and never heard of BOOST_JOIN before.
Thanks for the pointer, I tried this:
#define NAME BOOST_JOIN(ldpc_, SIMCASE) BOOST_PYTHON_MODULE (NAME) {
I got:
ldpc.cc: In function 'void initldpc_0()': ldpc.cc:102: error: 'init_module_ldpc_0' was not declared in this scope
For the record, my solution was to do my own macro expansion. I determined what BOOST_PYTHON_MODULE expanded to on my platform, then: #define MY_NAME BOOST_JOIN(ldpc_,SIMCASE) void BOOST_JOIN(init_module_,MY_NAME)(); extern "C" __attribute__ ((visibility("default"))) void BOOST_JOIN(init,MY_NAME)() { boost::python::detail::init_module( BOOST_STRINGIZE(MY_NAME), &BOOST_JOIN(init_module_,MY_NAME)); } void BOOST_JOIN(init_module_,MY_NAME)() {...
participants (3)
-
Anthony Foglia
-
Gennadiy Rozental
-
Neal Becker