|
Re: cast function, other ideas: msg#00015python.ctypes
Niki Spahiev <niki <at> vintech.bg> writes: > memcpy and strcpy are already usable: > > >>> import ctypes > >>> msvcrt = ctypes.cdll.msvcrt > >>> memcpy = msvcrt.memcpy There are a couple of problems here: 1. This isn't going to work on Unix. I don't know if there is an equivalent on Unix, but it's not portable as it stands (I don't know how critical this is). 2. This loads msvcrt. OK, at the moment, it's already loaded if you use the standard Python binaries, but Python 2.4 will use msvcr71. So you either write version-specific code, or load a whole second CRT just for memcpy. Neither of these are showstoppers, but I still prefer having basic memory manipulation functions directly available from ctypes. Arguably, only the mem* functions are fundamental, but the str* ones are worth having too, as zero-terminated character strings are so common. I have no strong opinion on the wide-character versions, as I don't do much with Unicode (I probably should, I know, but I don't think much of my code is likely to have an international audience :-)) Paul. ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: cast function, other ideas: 00015, Niki Spahiev |
|---|---|
| Next by Date: | Using ctypes to access OS X frameworks: 00015, Thomas Heller |
| Previous by Thread: | Re: cast function, other ideasi: 00015, Niki Spahiev |
| Next by Thread: | RE: cast function, other ideas: 00015, Mark McMahon |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |