Can I link in C object files created with another compiler?
DMD produces OMF (Microsoft Object Module Format) object files while other compilers such as VC++ produce COFF object files. DMD’s output is designed to work with DMC, the Digital Mars C compiler, which also produces object files in OMF format. The OMF format that DMD uses is a Microsoft defined format based on an earlier Intel designed one. Microsoft at one point decided to abandon it in favor of a Microsoft defined variant on COFF. Using the same object format doesn’t mean that any C library in that format will successfully link and run. There is a lot more compatibility required – such as calling conventions, name mangling, compiler helper functions, and hidden assumptions about the way things work. If DMD produced Microsoft COFF output files, there is still little chance that they would work successfully with object files designed and tested for use with VC. There were a lot of problems with this back when Microsoft’s compilers did generate OMF. Having a different object file forma
Related Questions
- What additional link flags do I need to specify when using MSVC 5.0 so that I can produce object files that the Etch Call Graph Profiler can process?
- Can I link the object files generated by Morpher with objects files generated by my favorite compiler (e.g. Microsoft Visual Studio)?
- Can I link in C object files created with another compiler?