By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,100 Members | 2,846 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,100 IT Pros & Developers. It's quick & easy.

Static (why?) PyDateTimeAPI and SIP

P: n/a
I use datetime C API in extension module generated with SIP. But SIP
break the code into several .cpp files compiled separately and
PyDateTimeAPI used by all macros constituting public interface is
declared static.

The current solution is to define my own functions in main module as
workaround:

%ModuleHeaderCode
PyObject * mxo_PyDateTime_FromDateAndTime(int year, int month, int day,
int hour, int minute, int seconds,
int usecs);
%End

%ModuleCode
PyObject * mxo_PyDateTime_FromDateAndTime(int year, int month, int day,
int hour, int minute, int seconds,
int usecs) {
return PyDateTime_FromDateAndTime(year, month, day, hour, minute, seconds,
usecs);
}
// and so on for each macro used
%End

%PostInitialisationCode
PyDateTime_IMPORT;
%End

But I wonder why PyDateTimeAPI is declared static, and is the a better
solution?

--
Denis S. Otkidach
http://www.python.ru/ [ru]
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.