[C++-sig] Cross module definition

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Sep 4 19:08:02 CEST 2003


This is my second attempt at replying to your message. Something
seems to be wrong with the mailing list...

Now trying to remember what I wrote:

--- Arnaud PICARD <arnaud.picard at edfgdf.fr> wrote:
> What do I have to do so that I can pull the line "define_Cmplx()" out of my
> ModuleB definition so that ModuleB's methods recognize my class Cmplx ?
> I've understood what was reponsded last time, but I have not been able to
> have it work properly...

It works perfectly here under Redhat 8.0. The only change I made to your
sources is to remove the define_Cmplx(); line from Boost_B.cc. I think
your problems must be due to how you compile and link. This is what
I did:

g++ -fPIC -ftemplate-depth-120 -w -DNDEBUG -O3 -I/net/cci/rwgk/hot/boost
-I/usr/include/python2.2 -c -o sandbx/cross_module_problem/Boost_A.os
/net/cci/rwgk/hot/sandbx/cross_module_problem/Boost_A.cc
g++ -fPIC -ftemplate-depth-120 -w -DNDEBUG -O3 -I/net/cci/rwgk/hot/boost
-I/usr/include/python2.2 -c -o sandbx/cross_module_problem/Boost_B.os
/net/cci/rwgk/hot/sandbx/cross_module_problem/Boost_B.cc
g++ -shared -o libtbx/sandbx_boost/ModuleB.so
sandbx/cross_module_problem/Boost_B.os -Llibtbx -lboost_python -lm
g++ -shared -o libtbx/sandbx_boost/ModuleA.so
sandbx/cross_module_problem/Boost_A.os -Llibtbx -lboost_python -lm

% cat tst.py
from sandbx_boost import ModuleA
from sandbx_boost import ModuleB
a = ModuleA.Cmplx( 1., 0. )
b = ModuleB.Printer()
b.print1( a )
b.print2( a )

% python tst.py
1 + 0 i
1 + 0 i

Ralf


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com




More information about the Cplusplus-sig mailing list