Boost logo

Boost Users :

Subject: Re: [Boost-users] boost python macro hell
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2010-01-14 12:17:23


Anthony Foglia wrote:

> Gennadiy Rozental wrote:
>> Neal Becker <ndbecker2 <at> gmail.com> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net