[C++-sig] export a constant

Scott A. Smith ssmith at magnet.fsu.edu
Wed May 22 18:03:43 CEST 2002


Greetings,

I cannot find anything on how to export a constant from C++
into Python.  Yes, I know I could just define it in Python
directly, but my goal is to have most everything from my code
accessible.

In one of my files I have defined in the header

extern const double PLANK;		// Plancks constant (h)         (J-sec)

and in the cc file

const double PLANK   = 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 = PLANK

Thanks,
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