No, that's correct-- it is possible to have multiple CRTs in the same process, if you are very careful to never let them see each other. So this means never calling malloc() in one dll and free() in another, and never calling open() in one dll and read() in another, etc. etc. It's very easy to screw this up, and actually impossible to get right for numpy (specifically when doing file io -- python assumes that file descriptor numbers are global across the process, so numpy needs to call read() on descriptors that were open()ed by python). So as a general solution for the masses, the only reasonable strategy is the one we're taking with mingwpy of making sure the compilers are just compatible in general. But for special cases if you're very careful, understand the issues, and are prepared to audit and debug all the code you're building, then mixing CRTs is technically possible.
One case where I guess we might be being over-careful is BLAS libraries, which have a narrow enough api that they might be immune to these issues... But since we have to fix the compiler anyway for numpy and scipy and everything, then it's a lot easier and less error prone to just use the fixed compiler for BLAS too.
-n
To view this discussion on the web visit https://groups.google.com/d/msgid/mingwpy/13c60f1a-f46c-4dd6-8b89-a622717e51f0%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "mingwpy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mingwpy+u...@googlegroups.com.
To post to this group, send email to min...@googlegroups.com.
For file descriptors, yes. For stdio FILE* you have the classic abi compatibility issues too :-). And so on...
> Is there a good reference for that somewhere?
Not that I know of, but there's really no other way to implement file descriptors on windows, so...
> I guess then, that reading a file object in runtime B that has been
> opened in runtime A will nearly always give nonsense or crash?
Yes.
-n
No, that's correct-- it is possible to have multiple CRTs in the same process, if you are very careful to never let them see each other. So this means never calling malloc() in one dll and free() in another, and never calling open() in one dll and read() in another, etc. etc. It's very easy to screw this up, and actually impossible to get right for numpy (specifically when doing file io -- python assumes that file descriptor numbers are global across the process, so numpy needs to call read() on descriptors that were open()ed by python). So as a general solution for the masses, the only reasonable strategy is the one we're taking with mingwpy of making sure the compilers are just compatible in general. But for special cases if you're very careful, understand the issues, and are prepared to audit and debug all the code you're building, then mixing CRTs is technically possible.
One case where I guess we might be being over-careful is BLAS libraries, which have a narrow enough api that they might be immune to these issues... But since we have to fix the compiler anyway for numpy and scipy and everything, then it's a lot easier and less error prone to just use the fixed compiler for BLAS too.
-n