.O object files ==> is format universal?

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

.O object files ==> is format universal?

Postby charles » Mon Feb 08, 2010 12:42 am

i been using pure pascal and gfa lately its good the gfa functions well and when making a stand alone executable , a file produced is labelled test.o

from what i know this file is a binary object file right?

now with pure pascal , the language allow object files to be included and used as modules

but the small problem i have is
the gfa .o is a different format
and
the little ttp program pure pascal threw in to make .o out of .pas files ,
doesn't fully convert a pas into a .o ,
or doesn't convert them atleast the way they have demonstration .o files on the disk allready.

whats missing or what have i missed?

how do i make a pure pascal .o file
(the editor uses it as long as {$L XXX.o} is included as directive)

or

how do i use some gfa code in .o format
within pure pascal ??

charles
atari is my lifestyle,not a hobby.
User avatar
charles
Atari God
Atari God
 
Posts: 1326
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada

Re: .O object files ==> is format universal?

Postby Frank B » Mon Feb 08, 2010 12:50 am

charles wrote:i been using pure pascal and gfa lately its good the gfa functions well and when making a stand alone executable , a file produced is labelled test.o

from what i know this file is a binary object file right?

now with pure pascal , the language allow object files to be included and used as modules

but the small problem i have is
the gfa .o is a different format
and
the little ttp program pure pascal threw in to make .o out of .pas files ,
doesn't fully convert a pas into a .o ,
or doesn't convert them atleast the way they have demonstration .o files on the disk allready.

whats missing or what have i missed?

how do i make a pure pascal .o file
(the editor uses it as long as {$L XXX.o} is included as directive)

or

how do i use some gfa code in .o format
within pure pascal ??

charles


Caveat I don't know anything at all about pure Pascal. You need to look at the documentation for the Pascal compiler to see what kind of object file it produces. You then need to look at whatever linker you're using to see if it's compatible with that object file type. Look at the arguments to the compiler and linker.
Check to see if it's possible to call GFA code from Pascal and vice versa. The ABI has to match.
User avatar
Frank B
Captain Atari
Captain Atari
 
Posts: 296
Joined: Wed Jan 04, 2006 1:28 am
Location: Paris

Re: .O object files ==> is format universal?

Postby charles » Mon Feb 08, 2010 2:29 am

so you think the compilier part will make a .o
ther eis a separete program to make obj it indicates.

well let the truth be known ,
i should get the pascal, using its own object functioning first,
before i go romping around trying out all type of different .o formats

the BINOBJ.TTP program included with ash's pure pascal
is what the demo programs have instructed to use to make object files ,,

but i try and i almost get there
but i arrive with the same as the source file only in .o file.

very small variation from original source compared to .o file the pascal demos use

,,,i did a check into the demo source(pre object file)
and the actual demo .o-'s files

they vary quite a bit in file structure ,,,

so i believe there must be a second pass to compile

i need step three of this process

step1:
my target source > binobj.ttp
>

step2:
XXX???.o
then >

??????????????never arrive at fully converting source to .o
even in its own pascal format

step 3
XXX???.o


why no finalize into pascal .o

charles
atari is my lifestyle,not a hobby.
User avatar
charles
Atari God
Atari God
 
Posts: 1326
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada

Re: .O object files ==> is format universal?

Postby lp » Mon Feb 08, 2010 3:09 am

There are several object file formats. I'm not going to state which is standard, that's open to debate. They all have pros/cons.

However, it requires that you read the manual and determine what format said compiler is creating. Also, some compilers are able to output in more than one format. Again, RTFM in order to change the output settings if that is even possible with pascal.

Also, read carefully. Object files created by GFA are in fact one of the standard formats (manual states this info), but the data section is cleverly compressed to save disk space, thus rendering them usable only by the GFA Linker. However, before you get all worked up, also note that the object files created by the GFA Compiler also assume certain registers contain certain values, so thus they are not portable anyway. :wink:

To clarify, do not try to link GFA object files with anything but the GFA Linker. Unless you like error messages and maybe even bombs. You might be able to link a object file created by pascal into a GFA project however, assuming you can sort out the manual. I don't know anything about Pascal, and I plan to keep it that way. :D
User avatar
lp
Atari Super Hero
Atari Super Hero
 
Posts: 944
Joined: Wed Nov 12, 2003 11:09 pm

Re: .O object files ==> is format universal?

Postby charles » Mon Feb 08, 2010 4:20 am

i cleverly guessed that the objects weren't universal, some standard ones may work but i don't want to play around with mix and matching until i know even how to make the standard dedicated objects work in the own machine..
its out of my league for the manual because its entirelly in german ,, well i don't have pure pascal manual in englisch and the help files are all in german

here is what it says

i gonna make new thread to ask for pure pascal manua( I USALLY DON'T ASK , I JUST TRY TO FIND FOR SALE OR EBAY)any how even translated don't do no good , babel fish only makes other languages difficult.

Code: Select all
PPU2O - Wandlung von bersetzten Pure Pascal Units in Pure C Objektfiles
========================================================================

Aufruf:

  PPU2O unit1.ppu [unit2.ppu ...]

wandelt die angegebenen Units in Objektfiles unit1.o ... um.
Gewandelt wird immer in Pure C Objektformat, Umwandlung in DRI-Format
ist nicht m”glich.


Optionen:

  (noch) keine.


PPU2O erlaubt es, Pure Pascal Programmteile von C oder Assemblerhaupt-
programmen aus aufzurufen.


Die Umwandlung durch PPU2O geschieht folgendermažen:

- Namen, die im Interfaceteil der Unit deklariert wurden, werden
   im Objektfile global.

- Namen, die im Implementierungsteil der Unit deklariert wurden,
   werden lokal.

- Namen, die aus anderen Units verwendet wurden, werden extern.

- Alle Namen werden bereits vom Pascal Compiler in Grožbuchstaben
   gewandelt, aber sonst nicht ver„ndert. Wenn gleichlautende
   Namen in verschiedenen Units vorhanden sind, kann es also
   zu Mehrfachdefinitionen von Namen im Pure C Linker kommen,
   auch wenn fr den Pascal Linker alles in Ordnung ist.

- Der Initialisierungsteil der Unit erh„lt den Namen der Unit.
   Selbst wenn der Quelltext leer ist, enth„lt der generierte Code
   Aufrufe zur Initialisierung der in USES-Klauseln aufgefhrten Units.
   Es empfiehlt sich daher, ihn beim Programmstart aufzurufen, falls
   der Pascalteil Routinen aus Bibliotheken bzw. anderen Units ver-
   wendet.


Auch die verwendeten Pure Pascal Bibliotheks-Units mssen mit PPU2O
gewandelt und hinzugebunden werden, damit der Linker keine undefinierten
Symbole meldet.


Sollen von Pascal aus C Routinen oder Variablen angesprochen werden,
so sollten diese fr Pascal in einer "Dummy"-Unit deklariert werden,
die selbst nicht gewandelt und hinzugebunden wird. Der Pascal-Compiler
erzeugt einen Aufruf auf den Initialisierungsteil dieser Unit, der
als C-Funktion vorhanden sein sollte, aber leer sein kann.


Da nun der Pure Pascal Startupcode nicht durchlaufen wird (sondern der
von C bzw. ein eigener), sind bestimmte Variable der Unit SYSTEM
nicht initialisiert und deshalb nicht benutzbar:

- Variable AppFlag zur Unterscheidung von Accessories und Programmen
   ist nicht gesetzt.
- Die Mechanismen zum Verlassen des Programms sind nicht initialisiert.
   Deshalb Programm ber die C-Mechanismen (exit() etc.) verlassen.
- Die Kommandozeile ist nicht aufbereitet, deshalb sind die Funktionen
   ParamCount und ParamStr nicht verwendbar.
- Variable BasePage ist nicht gesetzt.
- Variable StackLimit ist nicht gesetzt, damit funktioniert die
   $S-Option (Stack overflow checking) nicht richtig und sollte
   ausgeschaltet werden.


Die Aufrufkonventionen von Pure Pascal sind weitgehend mit Pure C
vertr„glich, in beiden Sprachen werden Parameter soweit wie m”glich
in Registern bergeben. Bei der Deklaration von Pascalroutinen in C
ist somit NICHT das Schlsselwort 'pascal' anzugeben.

N„heres zu den Aufrufkonventionen und zur internen Darstellung von
Pure Pascal Datentypen im Handbuch ab Seite 244 oder im Help unter:
Pascal/Pure Pascal intern.


Hier ein einfaches Beispiel, in dem eine in Pascal geschriebene
Funktion von C aus aufgerufen wird.

Zun„chst der Pascal Quelltext:

FAC_UNIT.PAS:
=========================================================================
Unit fac_unit;

interface

function fac( n : integer ) : integer;

implementation

function fac( n : integer ) : integer;
begin
  if n <= 0 then
    fac := 1
  else
    fac := fac( n - 1 ) * n;
end;

end.
=========================================================================


Hier das Hauptprogramm in C:

FAC_MAIN.C:
=========================================================================
#include   <stdio.h>

extern   void   FAC_UNIT(void);      /* Initialisierungsteil */
extern   int   FAC( int n );      /* function fac ...     */

main()
{
   int   fac5;

   FAC_UNIT();      /* Initialisiere die Unit */

   fac5 = FAC(5);  /* Aufruf der Funktion */

   printf("fac(5) = %d\n", fac5);

   return(0);
}
=========================================================================


Die Projektdatei fr Pure C:

=========================================================================
fac.prg
=
pcstart.o      ; C-Startupcode
fac_main.c   ; Hauptprogram in C
fac_unit.o      ; Gewandelte Pascal Unit
system.o      ; Gewandelte Pascal System Unit
pcstdlib.lib   ; C-Standardbibliothek
=========================================================================


Zum Zusammenbauen mssen wir zun„chst in Pure Pascal den Quelltext
FAC_UNIT.PAS in FAC_UNIT.PPU bersetzen.

Dann mssen FAC_UNIT.PPU und die System Unit SYSTEM.PPU in Pure C
Objektdateien gewandelt werden:

    PPU2O FAC_UNIT SYSTEM

Schliežlich veranlassen wir in Pure C mit Make ... die šbersetzung
von FAC_MAIN.C und das Linken des Programms.




i think it something about how to use a c or asm filke as a ppu then compilie to a object file for use in the pure pascal editor..

so any body have an english manual for pure pascal?


charles
atari is my lifestyle,not a hobby.
User avatar
charles
Atari God
Atari God
 
Posts: 1326
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada

Re: .O object files ==> is format universal?

Postby wongck » Mon Feb 08, 2010 11:59 am

I thought all objects file are the same. :?
My Atari Stuff: Falcon CT63 14+512MB 20GB DVD / TT030 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
User avatar
wongck
Fuji Shaped Bastard
Fuji Shaped Bastard
 
Posts: 3478
Joined: Sat May 03, 2008 2:09 pm
Location: Far East

Re: .O object files ==> is format universal?

Postby charles » Mon Feb 08, 2010 3:48 pm

i thought all were same too , except dri and binary , but there are different formats of each.

so far i have no luck , but have found good secondary measures.... make units which are likeinclude files and utilize those,

i am getting the suspicion that the .o files are maybe not generated by pascal what so ever
that i should use a c compilier to compilie a source into linkable object
then use my pascal binobj.ttp ,make object ,so use as loadable object within pascal.

but where do the external refernces and pascal declarations fit into this ...

i'll post the files which work and then you bunch will have a refernce point
and see what this ordeal is about.

i'm home sick from work today , no not from the super bowl recovery , but i have a cold so i might be slow-ish , but until i get tired , i'll just use computer.


ok see attachments
cpas

add.c c source of add inegers
add inc pascal declaration of funcion add
add.pas the file which pascal editior uses to perform the linkable code
add.o the object some how made with binobj.ttp???????
how to shows another example of linkable code
sub.c my attempt to duplicate add.c and the add.o routines


charles
You do not have the required permissions to view the files attached to this post.
atari is my lifestyle,not a hobby.
User avatar
charles
Atari God
Atari God
 
Posts: 1326
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada

Re: .O object files ==> is format universal?

Postby lp » Mon Feb 08, 2010 4:40 pm

wongck wrote:I thought all objects file are the same. :?


The book "Modern Atari System Software" from HiSoft has a good section on all the popular object file formats. However, the book does not mention the format used by gcc, which of course is yet another one.
User avatar
lp
Atari Super Hero
Atari Super Hero
 
Posts: 944
Joined: Wed Nov 12, 2003 11:09 pm

Re: .O object files ==> is format universal?

Postby Nyh » Mon Feb 08, 2010 11:42 pm

wongck wrote:I thought all objects file are the same. :?

No, the most portable object file format seems to be the DRI object file. Pure C has a special switch to generate them.

Hans Wessels
User avatar
Nyh
Atari God
Atari God
 
Posts: 1226
Joined: Tue Oct 12, 2004 2:25 pm
Location: Netherlands

Re: .O object files ==> is format universal?

Postby charles » Tue Feb 09, 2010 3:38 am

okay i got it now ,
its all finalized,,

its pure c object code that pure pascal can use as linkable code,,,
probally said that in the help files but they are all in hungaruian or german or duetche

i set out tonight using devpac 3 and making object code but this did not every work correctly
when linked to pascal

so i eventually chased after c ,,(this is the first time i ever tryied c too!)
pure c seems easy to use and the compilier is almost exactually like pure pascal

i might just be able to understand c at some point ! maybe even learn too!

charles

now i wonder if i load my asm code into pure c
and compile
will this code be readable by pascal linked functions and procedures
????????????????????????test test test gotta pass the tests!!!!!!!!!!!!!!!!!!!!!!!!!!!!
atari is my lifestyle,not a hobby.
User avatar
charles
Atari God
Atari God
 
Posts: 1326
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada

Re: .O object files ==> is format universal?

Postby wongck » Tue Feb 09, 2010 11:56 am

charles wrote: its pure c object code that pure pascal can use as linkable code,,,
probally said that in the help files but they are all in hungaruian or german or duetche

Use google translate - it has an auto mode so you don't have to figure out the language.
Then use the language found by google to do your translation.
My Atari Stuff: Falcon CT63 14+512MB 20GB DVD / TT030 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
User avatar
wongck
Fuji Shaped Bastard
Fuji Shaped Bastard
 
Posts: 3478
Joined: Sat May 03, 2008 2:09 pm
Location: Far East

Re: .O object files ==> is format universal?

Postby wongck » Tue Feb 09, 2010 12:10 pm

charles wrote:i might just be able to understand c at some point ! maybe even learn too!

C is quite simple, if you know the structured language of pascal.
In Uni they taught only pascal but I picked up C.
Just look out for the shortforms & short cuts in assignments.
My Atari Stuff: Falcon CT63 14+512MB 20GB DVD / TT030 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
User avatar
wongck
Fuji Shaped Bastard
Fuji Shaped Bastard
 
Posts: 3478
Joined: Sat May 03, 2008 2:09 pm
Location: Far East

Re: .O object files ==> is format universal?

Postby joska » Tue Feb 09, 2010 12:25 pm

charles wrote:i set out tonight using devpac 3 and making object code but this did not every work correctly
when linked to pascal


If Pure Pascal is like Pure C, it can be configured to create objects in DRI format. The same applies to Devpac 3 IIRC (haven't used it since 1994). But doesn't Pure Pascal have it's own assembler?

charles wrote:so i eventually chased after c ,,(this is the first time i ever tryied c too!)
pure c seems easy to use and the compilier is almost exactually like pure pascal


I suggest you stick with pascal until you've learned it properly.

charles wrote:now i wonder if i load my asm code into pure c
and compile
will this code be readable by pascal linked functions and procedures


Only if you know how Pure Pascal pass parameters to functions. Pure C use registers unless told otherwise (cdecl), I don't know how Pure Pascal does it.
Jo Even

Milan060 - Falcon040 - Falcon030 - FreeMiNT - XaAES
joska
Atari Super Hero
Atari Super Hero
 
Posts: 525
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway

Re: .O object files ==> is format universal?

Postby lp » Tue Feb 09, 2010 4:57 pm

joska wrote:If Pure Pascal is like Pure C, it can be configured to create objects in DRI format. The same applies to Devpac 3 IIRC (haven't used it since 1994). But doesn't Pure Pascal have it's own assembler?


Correct, Devpac 3 can create DRI format object files with some option. That's how I use it with my GFA projects.
Last edited by lp on Wed Feb 10, 2010 3:29 pm, edited 1 time in total.
User avatar
lp
Atari Super Hero
Atari Super Hero
 
Posts: 944
Joined: Wed Nov 12, 2003 11:09 pm

Re: .O object files ==> is format universal?

Postby charles » Wed Feb 10, 2010 12:12 am

okay i'll do some "rooting " around but be pateince !!!!
its not the ability to accept ideals ,
its the ability to test these suggestions while or after learning
which may appear that i do not apadpt advice.

its enough right there in the past two responces to keep me busy for a month !

charles
atari is my lifestyle,not a hobby.
User avatar
charles
Atari God
Atari God
 
Posts: 1326
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada


Return to Coding

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests