Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c Subject: Re: object file compatiblity Date: Mon, 26 Oct 2015 10:43:34 +1300 Lines: 33 Message-ID: References: <1216aa49-f60e-48f9-983a-aebe69a514b6@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net LJiZsoXYEKZDtRlSnLZmJgSpaTCA2ebSJH4TOrYMDdydpPn2La Cancel-Lock: sha1:AzKhBG7tZTwLjNE6MiIebMnrZ6w= User-Agent: Mozilla/5.0 (X11; SunOS i86pc; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: <1216aa49-f60e-48f9-983a-aebe69a514b6@googlegroups.com> Xref: csiph.com comp.lang.c:73799 paul.anton.letnes@gmail.com wrote: > Hi! > > Disclaimer: I've programmed very little pure C in my life, and don't > consider myself a C programmer. You probably don't, either. > > I've got an object file that is difficult to recreate from source in > my C/Fortran mixed-language project. This object file is generated > from a C source file, but it's not written by me - build system nor > source code. It's compiled by MSVC from visual studio 2013. Is this > object file (.obj) compatible for linking with Visual Studio > 2010/2012/2015 compiled code? What if I create a static library > (.lib) containing this single object file? > > What I've got in mind is checking the object file into git and > linking it in with the rest of the project which is compiled from > source every time. Colleagues might use other versions of MSVC/Visual > Studio, though, so that's something I need to understand. > > I'd appreciate any pointers to documentation that explains this in > more detail. There isn't really a generic C answer to this question, the answer would be platform specific. In general, with a reasonably long list of ifs it might work :) The ifs would include the level of optimisation used, compiler options that may change the layout of data, platform ABI stability and so forth. If the file does link, test it to death. -- Ian Collins