[C++-sig] export a constant
Scott A. Smith
ssmith at magnet.fsu.edu
Wed May 22 19:02:07 CEST 2002
Thanks David,
But this did not work. In MSVC++ it give the following error:
error C2065: 'make_ref' : undeclared identifier
The code had the following lines (amidst a multitude of others):
#include <boost/python/class_builder.hpp> // Boost class stuff
#include <boost/python/reference.hpp> // Boost referencing
boost::python::module_builder pygamma("pygamma"); // Extension module
pygamma.add(make_ref(PLANCK), "PLANCK"); // Export constant
PLANCK
I am running MSVC++ 6.0 SP4 with Python 2.0.1 and Boost 1.25.0.
The build is on lots of code and works well enough to produce a dll.
Is there a place in the documentation where I should be looking?
> > const double PLANCK = 6.6260755e-34; // Plancks constant (h)(J-sec)
> >
> > Is there a way to just export this using Boost.Python so that
> > in Python I can just do
> >
> > h = PLANCK
>
> In Boost.Python v1, you can do:
>
> #include <boost/python/reference.hpp>
> my_module_builder.add(make_ref(PLANCK), "PLANCK");
Regards,
Scott
-----------------------------------------
-----------------------------------------
Dr. Scott A. Smith
Associate in Research
National High Magnetic Field Laboratory
1800 East Paul Dirac Drive
Tallahassee, FL 32310
phone: (850) 644-6348
FAX: (850) 644-1366
email: ssmith at magnet.fsu.edu
http://www.magnet.fsu.edu
http://gamma.magnet.fsu.edu
More information about the Cplusplus-sig
mailing list