Are object files platform dependent? Can you use object files created on Windows with a project compiled on Linux? Never used them before.
Something tells me they ARE platform independent since they have to be linked in.

Mailing lists / fpc-pascal / 2011-07
7 messages · 5 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Are object files platform dependent? Can you use object files created on Windows with a project compiled on Linux? Never used them before.
Something tells me they ARE platform independent since they have to be linked in.
Are object files platform dependent?
No
Can you use object files created on Windows with a project compiled on Linux?
Only if they're cross compiled to target Linux
Something tells me they ARE platform independent since they have to be linked in.
Pardon me? That seems unrelated. Object files are basically executables with external symbols unresolved and no starting point, do you think executables platform independent?
leledumbo wrote> Are object files platform dependent? No
Depending on the context the author thought in this could have been answered with "yes, mostly" as well:
You can't use object files from x86 on ARM or from Windows on Linux (in the sense of using the object file from the other platform and trying to link and run it on this platform (without emulation)). The last restriction basically because the output format is different (PE/COFF vs ELF). The object files between e.g. Win32 and WinCE on x86 are compatible and the different ELF based systems might be compatible if they run on the same platform (don't know that for sure though). But even if you'd have compatible object files you'd have the problem that e.g. the Linux one might contain different assumptions about structures and call different functions than the FreeBSD one (thus problems when linking or during runtime).
Regards,
Sven
No Only if they're cross compiled to target Linux Pardon me? That seems unrelated. Object…
He's asking exactly this. If there was no difference in calling conventions and every access to the OS was through the RTL it could be cross-platform in this sense (since he's changing the OS but not the processor/architecture).
-Flávio
Depending on the context the author thought in this could have been answered with "yes,…
In our previous episode, Sven Barth said:
Linux and FreeBSD are very compatible, or at least used to (last time I tested in 6.x,7.x times'. If I compiled the compiler for FreeBSD on Linux, with linux binwriter and LD, I could use to result to bootstrap after running brandelf (which fixes the ELF identifier)
I also tried this with some other tools, but it didn�t work for all binaries. IIRC some crt examples behaved funky.
Of course with FreeBSD 9.0 switching from gcc to clang might have an impact there (though most ports will remain compiling with gcc for now)
He's asking exactly this. If there was no difference in calling conventions and every…
since he's changing the OS but not the processor/architecture
Right, I forgot this one. Thanks for clarifying. COFF IS cross-OS but not cross architecture, though many other object formats aren't.
OK, from a practical standpoint, I can't interchange obj files like that.
I am writing an application which is a kind of mini IDE used to write web scripts in pascal within a fairly narrow use case. The mini IDE would produce an executable based on fpWeb (<f>cgi, apache mod, maybe ISAPI someday...?) and my own framework as the base, with the user of the mini IDE contributing some code/scripts, but mainly the ide will scaffold objects, controllers, etc and produce a resulting executable which can be deployed.
My thought was to use obj files for my framework code and distribute them with the IDE application and a minimum fpc installation (or the user having downloaded/built from source, etc). The idea being that I could distribute my code in non-source form and have it linked in the resulting executable produced by the mini ide application when the user builds the project.
Looks like I'll just need to compile the object files on target platforms. NP.