Automatically detect wrong lib-format for borland compiler?

I just had the idea to make bcccompiler a little bit more robust. By default, python is delivered with pythonxx.lib and pythonxx_d.lib import libraries generated by MSVC, which are in COFF format. By inspection I found that these libraries start with the bytes '!<arch>./' (without the single quotes). Shouldn't we open these files and issue a warning or error if they start with these bytes? We could even invoke borland's coff2omf utility to convert them... Thomas

Thomas Heller wrote:
I just had the idea to make bcccompiler a little bit more robust.
By default, python is delivered with pythonxx.lib and pythonxx_d.lib import libraries generated by MSVC, which are in COFF format. By inspection I found that these libraries start with the bytes '!<arch>./' (without the single quotes).
'!<arch>\012/'
Shouldn't we open these files and issue a warning or error if they start with these bytes? We could even invoke borland's coff2omf utility to convert them...
But where to write the converted files, in the python libs directory is not a good idea and if you would write them in the build-temp directory you had to add code to find_library_file(). It might be better to have script(s) in the misc directory, which checks for a certain compiler the libraries and converts them if necessary. The compiler classes would print a warning/error message about the wrong format and could mention how to convert the library.

On 29 September 2000, Rene Liebscher said:
It might be better to have script(s) in the misc directory, which checks for a certain compiler the libraries and converts them if necessary.
The compiler classes would print a warning/error message about the wrong format and could mention how to convert the library.
I think I prefer this approach -- easy to go overboard here. Being smart enough to *detect* a possible bad situation is reasonable, but trying to be smart enough to *correct* it is asking for trouble. Greg -- Greg Ward gward@python.net http://starship.python.net/~gward/

Also see the recent thread in c.l.p (which says, as I understand it: using the MSVC import libraries with borland-compiled extensions is at least dangerous, because the wrong C-runtime library may be used for stdoi) Thomas
participants (3)
-
Greg Ward
-
Rene Liebscher
-
Thomas Heller