Message226035
> Stefan (Behnel), could you comment on the strategy that you had in mind?
> Is it similar to module_get_symbol.diff or entirely different?
I agree with Antoine that a Capsule would work better here (and yes, the performance problem of capsules is only with cases where they need to be unpacked frequently). Here is our current API for datetime as an example:
https://github.com/cython/cython/blob/e6c13f8922d6406f64f2578f5a0041e1615291a3/Cython/Includes/cpython/datetime.pxd
It's not great (it would be possible to make it look more OOP-ish), but it's simple and quite easy to use. The top of the file contains the necessary header declarations, and the rest are inline C wrapper functions that basically just rename the existing capsule C-API functions and macros to make them easily and nicely callable from Cython code without having to care about the Capsule and its list of C functions.
The declarations for _cdecimal would use a similar scheme and additionally include the libmpdec header declarations so that users could work with the underlying C data directly with a single (c-)import. That would then require the libmpdec symbols to be available, though, also when it's linked internally into _cdecimal. |
|
Date |
User |
Action |
Args |
2014-08-28 17:56:00 | scoder | set | recipients:
+ scoder, lemburg, loewis, pitrou, skrah |
2014-08-28 17:56:00 | scoder | set | messageid: <1409248560.66.0.753009659406.issue22194@psf.upfronthosting.co.za> |
2014-08-28 17:56:00 | scoder | link | issue22194 messages |
2014-08-28 17:56:00 | scoder | create | |
|