[Python-Dev] Linking with mscvrt (original) (raw)

Neil Hodgson nyamatongwe at gmail.com
Thu Feb 9 23:00:51 CET 2006


Paul Moore:

This has all been thrashed out before, but the issue is passing CRT-allocated objects across DLL boundaries.

Yes, that was the first point I addressed through wrapping CRT objects.

At first glance, this is a minor issue - passing FILE* pointers across DLL boundaries isn't something I'd normally expect people to do - but look further and you find you're opening a real can of worms. For example, Python has public APIs which take FILE* parameters.

So convert them to taking PyWrappedFile * parameters.

Further, memory allocation is CRT-managed - allocate memory with one CRT's malloc, and dealloacte it elsewhere, and you have issues. So any pointer could be CRT-managed, to some extent. Etc, etc...

I thought PyMem_Malloc was the correct call to use for memory allocation now and avoided direct links to the CRT for memory management.

Neil



More information about the Python-Dev mailing list