Using Pure C from a CLI

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

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

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

Using Pure C from a CLI

Postby JonB » Sat Aug 11, 2012 10:29 am

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

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 4873
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Using Pure C from a CLI

Postby simonsunnyboy » Sat Aug 11, 2012 10:59 am

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/ - STOT: http://www.npoi.de/stot/

Stay cool, stay Atari!

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

Jabber: simonsunnyboy@atari-jabber.org

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

Re: Using Pure C from a CLI

Postby JonB » Sat Aug 11, 2012 1:02 pm

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: 169
Joined: Thu Jan 07, 2010 4:30 pm

Re: Using Pure C from a CLI

Postby helmut » Sat Aug 11, 2012 11:45 pm

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

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 4873
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Using Pure C from a CLI

Postby simonsunnyboy » Sun Aug 12, 2012 10:52 am

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/ - STOT: http://www.npoi.de/stot/

Stay cool, stay Atari!

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

Jabber: simonsunnyboy@atari-jabber.org

helmut
Captain Atari
Captain Atari
Posts: 169
Joined: Thu Jan 07, 2010 4:30 pm

Re: Using Pure C from a CLI

Postby helmut » Sun Aug 12, 2012 1:51 pm

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

Postby JonB » Sun Aug 12, 2012 4:22 pm

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: 169
Joined: Thu Jan 07, 2010 4:30 pm

Re: Using Pure C from a CLI

Postby helmut » Sun Aug 12, 2012 7:48 pm

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

Postby JonB » Sun Aug 12, 2012 8:00 pm

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: 169
Joined: Thu Jan 07, 2010 4:30 pm

Re: Using Pure C from a CLI

Postby helmut » Sun Aug 12, 2012 8:27 pm

Yes - please tell me, but it''s plink.ttp -c=<.lnk-file> (forgot the =)

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 4873
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Using Pure C from a CLI

Postby simonsunnyboy » Mon Aug 13, 2012 3:05 pm

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/ - STOT: http://www.npoi.de/stot/

Stay cool, stay Atari!

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

Jabber: simonsunnyboy@atari-jabber.org


Social Media

     

Return to “C / PASCAL etc.”

Who is online

Users browsing this forum: No registered users and 2 guests