Using Pure C from a CLI

C and PASCAL (or any other high-level languages) in here please

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

Post Reply
JonB
Captain Atari
Captain Atari
Posts: 303
Joined: Fri Dec 02, 2011 5:01 pm

Using Pure C from a CLI

Post by JonB »

Hi

In my search for a better C implementation, I am trying out Pure C. It works well with its own IDE, but I want to use it with gulam (UNIX-like command line interpreter). Problem is, I don't know how to tell it where the headers and libraries reside. I assume there are environment variables to set... but what are they?

Cheers

JonB

PS, I really would like not to use the UDE as it doesn't suit me. I like vi, cli and compiler / linker (preferably with make). Old school. ;)
Too many retro computers here: 1040STfm, Mega4, Ultrasatanx2 , Amiga A500, A500+ and A1200, Acorn Atom x2, BBC Micro, Electron, Spectrum 48k x2, +48, +128k, QL, Oric Atmos, ZX81, Memotech MTX512, Amstrad 6128 x2..
simonsunnyboy
Moderator
Moderator
Posts: 5235
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Using Pure C from a CLI

Post by simonsunnyboy »

If you find out how, please post an elaborate HOWTO.

My attempts failed with the linker. I never was able to make it work and that's why I ended up using AHCC instead. (It is tons better anyway as it is still supported and freeware.)
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee
JonB
Captain Atari
Captain Atari
Posts: 303
Joined: Fri Dec 02, 2011 5:01 pm

Re: Using Pure C from a CLI

Post by JonB »

darn it.. :(

Good job I have AHCC as well...
Too many retro computers here: 1040STfm, Mega4, Ultrasatanx2 , Amiga A500, A500+ and A1200, Acorn Atom x2, BBC Micro, Electron, Spectrum 48k x2, +48, +128k, QL, Oric Atmos, ZX81, Memotech MTX512, Amstrad 6128 x2..
helmut
Captain Atari
Captain Atari
Posts: 175
Joined: Thu Jan 07, 2010 4:30 pm

Re: Using Pure C from a CLI

Post by helmut »

Call pcc.ttp -I$INCLUDE. $INCLUDE is a semicolon-separated path.

Under MiNT this can have / as path-sep, e.g.: /usr/local/include;/usr/local/include/sys;/include.

I use pcc.ttp in makefiles and nearly managed to handle it like a unix-compiler using shell-scripts for compiling and linking, but I doubt this would easily work with gulam. I don't think this would ever be possible with AHCC (it does not even have -o <output>).

The pure-linker takes object-files as arguments, so you can also drop the .lnk-file.

-Helmut
simonsunnyboy
Moderator
Moderator
Posts: 5235
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Using Pure C from a CLI

Post by simonsunnyboy »

I don't think it is necessary to drive the compiler and linker seperately. gcc does it in an integrated fashion and I think AHCC is right not to expose this on such a low level. Dropping project iles on the TTP compiler works really well and AHCC skips files that do not need recompiling.

Maybe you can post the complete command lines for Pure C here? I don't remember exactly but I had serious problems with the linker to find its libraries and all.
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee
helmut
Captain Atari
Captain Atari
Posts: 175
Joined: Thu Jan 07, 2010 4:30 pm

Re: Using Pure C from a CLI

Post by helmut »

simonsunnyboy wrote:
Maybe you can post the complete command lines for Pure C here? I don't remember exactly but I had serious problems with the linker to find its libraries and all.
Just call it without args.
JonB
Captain Atari
Captain Atari
Posts: 303
Joined: Fri Dec 02, 2011 5:01 pm

Re: Using Pure C from a CLI

Post by JonB »

Fine if you're using the IDE (pc.prg) but not from the command line. I got the compiler to find its include files with -I<path_to_include_directory>. I now need the same for the linker... but the object files are all in libs, so listing a .o is not going to work..
Too many retro computers here: 1040STfm, Mega4, Ultrasatanx2 , Amiga A500, A500+ and A1200, Acorn Atom x2, BBC Micro, Electron, Spectrum 48k x2, +48, +128k, QL, Oric Atmos, ZX81, Memotech MTX512, Amstrad 6128 x2..
helmut
Captain Atari
Captain Atari
Posts: 175
Joined: Thu Jan 07, 2010 4:30 pm

Re: Using Pure C from a CLI

Post by helmut »

JonB wrote:Fine if you're using the IDE (pc.prg) but not from the command line. I got the compiler to find its include files with -I<path_to_include_directory>. I now need the same for the linker... but the object files are all in libs, so listing a .o is not going to work..
There are two ways to do this:

1. use an .lnk-file and write all objects you want (including libs - at the end) into it.

For example:

Code: Select all

-O=<your program> -S=<stack-size> <more linker-options>
\mint\crt0.o
<your .o-files>
<your libs>
<standard-libs, e.g.:>
\mint\d_flt.lib
\mint\mintlib.lib
\pure_c\lib\pcfltlib.lib
This is from an example from my disk, your needs may vary. Then call plink.ttp -c <your-lnk-file>.

2. Put everything in the commandline (like above, just the content of the .lnk-file as commandline (lines -> words).

Of course you need a shell to put this into scripts or make to do this in a practicable manner.
JonB
Captain Atari
Captain Atari
Posts: 303
Joined: Fri Dec 02, 2011 5:01 pm

Re: Using Pure C from a CLI

Post by JonB »

Thanks for that, helmut - I'll give it a try and let you know how it goes.
Too many retro computers here: 1040STfm, Mega4, Ultrasatanx2 , Amiga A500, A500+ and A1200, Acorn Atom x2, BBC Micro, Electron, Spectrum 48k x2, +48, +128k, QL, Oric Atmos, ZX81, Memotech MTX512, Amstrad 6128 x2..
helmut
Captain Atari
Captain Atari
Posts: 175
Joined: Thu Jan 07, 2010 4:30 pm

Re: Using Pure C from a CLI

Post by helmut »

Yes - please tell me, but it''s plink.ttp -c=<.lnk-file> (forgot the =)
simonsunnyboy
Moderator
Moderator
Posts: 5235
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Using Pure C from a CLI

Post by simonsunnyboy »

Seeing this setup I wonder what's the real diference to using the .PRJ file instead which has this listing of object files and libs aswell?
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee
Post Reply

Return to “C / PASCAL etc.”