How to add new library in gcc?

A

Ardhendu Nandan

Hi,
Like turbo c(tlib.exe),is there any utility in gcc to add new library?

regards
Ardhendu
 
D

dandelion

Ardhendu Nandan said:
Hi,
Like turbo c(tlib.exe),is there any utility in gcc to add new library?

Assuming you are using a unix-like platform...

checkout "ar" and "ranlib"
 
M

Mark McIntyre

On 26 Nov 2004 01:12:49 -0800, in comp.lang.c ,
Hi,
Like turbo c(tlib.exe),is there any utility in gcc to add new library?

sure, but its offtopic here. Try a gcc or gnu group. Or read the
docs/manuals. Or websearch for "create library with gcc". Ar.
 
T

tony

you can make a batch file to run ranlib. Then just do (example from a
68k embedded board.

ar rvs NAMEOFAFILE.a OBJECTFILE1.o OBJECTFILE2.o
m68k-coff-ranlib NAMEOFAFILE.a

where NAMEOFAFILE.a is the is the libary you wish to produce.
OBJECTFILE1.o ext are the names of the object files you wish to add.

remember to add a .h storeing all the .h files that you've added to
the libary file. ie in NAMEOFAFILE.h have
#include "OJECTFILE1.h"
#include "OJECTFILE2.h"

Then in your makefile you'll need to add your libary with something
like

llibary1= ..location of NAMEOFAFILE
iLibary1= ..location of NAMEOFAFILE

you'll have to make sure all flags in the make show the libary

IFLAGS= -I$(ilibary1)
lib= -lLibary1


in the pattern rules you'll have to add the flags
%.o : %.c
$(IFLAGS) $< -o $@


finally in any c file that you now call the libary file from you have
to add the NAMEFILE.h
 
F

Flash Gordon

On 30 Nov 2004 08:25:37 -0800
you can make a batch file to run ranlib. Then just do (example from a
68k embedded board.

ar rvs NAMEOFAFILE.a OBJECTFILE1.o OBJECTFILE2.o
m68k-coff-ranlib NAMEOFAFILE.a

<snip>

Strange than none of my Windows, Linux, SCO or AIX systems have a
command "m68k-coff=ranlib". Since they all have C implementations that
at least attempt to achieve C89 conformance I would have thought this
command would be included...

Oh, wait a moment, you are posting off topic rubbish in comp.lang.c,
please dodn't provide off topic advice here, it often does not help the
person wanting assistance as any errors are unlikely to be corrected.

Also, please quote enough of the post you are replying to for people to
see the context.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,404
Latest member
PerryRutt

Latest Threads

Top