Object Files

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Object Files

Lee Jenkins

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.

--
Warm Regards,

Lee

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Object Files

leledumbo
Administrator
> 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?
Reply | Threaded
Open this post in threaded view
|

Re: Object Files

Sven Barth-2
On 18.07.2011 19:07, 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Object Files

etrusco
In reply to this post by leledumbo
On Mon, Jul 18, 2011 at 2:07 PM, leledumbo <[hidden email]> wrote:
>> Are object files platform dependent?
>
> No

>From the rest of your post I guess you mean "yes, they are dependent"?


>
>> 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?
>

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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Object Files

Marco van de Voort
In reply to this post by Sven Barth-2
Reply | Threaded
Open this post in threaded view
|

Re: Object Files

leledumbo
Administrator
In reply to this post by etrusco
> 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.
Reply | Threaded
Open this post in threaded view
|

Re: Object Files

Lee Jenkins
On 7/19/2011 9:40 AM, leledumbo wrote:
>> 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.


--
Warm Regards,

Lee

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal