Cpp + Python: static data dynamic initialization in *nix shared lib?

Ian Collins ian-news at hotmail.com
Fri Jul 9 17:22:43 EDT 2010


On 07/10/10 03:52 AM, Alf P. Steinbach /Usenet wrote:
> [Cross-posted comp.lang.python and comp.lang.c++]
>
> I lack experience with shared libraries in *nix and so I need to ask...
>
> This is about "cppy", some support for writing Python extensions in C++
> that I just started on (some days ago almost known as "pynis" (not funny
> after all)).
>
> For an extension module it seems that Python requires each routine to be
> defined as 'extern "C"'. And although e.g. MSVC is happy to mix 'extern
> "C"' and C++ linkage, using a routine declared as 'static' in a class as
> a C callback, formally they're two different kinds, and I seem to recall
> that /some/ C++ compiler balks at that kind of mixing unless specially
> instructed to allow it. Perhaps it was the Sun compiler?

Yes, it will (correctly) issue a warning.

As the is a bit OT, contact me directly and we can work through it.  I 
have had similar fun and games adding PHP modules!

-- 
Ian Collins



More information about the Python-list mailing list