[C++-SIG] Beginer questions

Geoffrey Furnish furnish at actel.com
Mon Nov 15 18:34:02 CET 1999


Jonathan Wight writes:
 > on 11/14/99 20:54, Paul F. Dubois at dubois1 at llnl.gov wrote:
 > 
 > > This reminds me to call attention of the C++ SIG to the article
 > > in the July/Aug 1999 C++ report that explains that pointers to C
 > > functions and pointers to C++ functions are no longer type
 > > compatible.  This has serious implications for extending Python
 > > with C++, in that Python's tables expect a C function. Up to now
 > > it has been possible to just cast whatever to PyCFunction and
 > > move on; evidently some compilers will now start to object to
 > > that if the function in question is a C++ one. I haven't had time
 > > to look at this to see if I have a decent work-around.
 > 
 > If it is a static function couldn't you just declare it as " extern
 > "C" "???  I know that works fine for various callbacks in the OS.

You can declare a non-member function in C++ to have extern "C"
linkage, whether it is static or not.  Of course you lose linkage
safety if you do this, but you can do it.

-- 
Geoffrey Furnish            Actel Corporation        furnish at actel.com
Senior Staff Engineer      955 East Arques Ave       voice: 408-522-7528
Placement & Routing     Sunnyvale, CA   94086-4533   fax:   408-328-2303

"... because only those who write the code truly control the project."
						      -- Jamie Zawinski




More information about the Cplusplus-sig mailing list