Hi all, please forgive my crappy knowledge of C, etc. in advance... ;)

In updating my osaterminology package to support Tiger, I've added a new 
function, OSAGetSdef(), to its OSATerminology.so extension [1]. To allow the 
extension to build on older OSes, I've inserted an #ifdef as shown:

static PyObject *
PyOSA_GetSdef(PyObject* self, PyObject* args)
{
        #ifdef AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
        ...
        err = OSACopyScriptingDefinition(&fsref, 0, &sdef);
        ...
        return res;
        #else
        /*
        Return None when sdef is unobtainable.
        Client can then call OSAGetTerminology() instead.
        */
        Py_INCREF(Py_None);
        return Py_None;
        #endif
}

But now I realise this doesn't help in making a compiled extension work across 
different OSes, so I obviously need to do something more/else. 

Obviously the extension needs to be built on Tiger to provide sdef support, but 
what should I do to ensure that, say, applications containing that binary 
extension will still work OK when run on earlier OSes? For example, should I 
include both extension builds in the osaterminology package and have it import 
the appropriate one according to OS version, or is there a better/more 
elegant/official way of doing it?

Many thanks,

has

[1] This is a modified version of OSATerminology.so that's bundled in the 
osaterminology package, btw; I don't use the original copy in lib-dynload as 
it's buggy.
-- 
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to