Path: chuka.playstation.co.uk!news From: "Peter Armstrong" Newsgroups: scee.yaroze.programming.gnu_compiler,scee.yaroze.programming.libraries Subject: Re: Making my own library for the NY. Date: Sun, 22 Aug 1999 14:44:07 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 61 Message-ID: <7pousa$8mo9@chuka.playstation.co.uk> References: <7pkcms$8mo2@chuka.playstation.co.uk> NNTP-Posting-Host: host5-171-250-193.btinternet.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Xref: chuka.playstation.co.uk scee.yaroze.programming.gnu_compiler:336 scee.yaroze.programming.libraries:224 Rikki Prince wrote: > > A couple of questions on this subject. Firstly, is the input file a normal > .c file with a group of functions? I just want to check this, as I've tested > making .lib files with lcc-win32, which is a variant of gcc, and it worked > in that, but I just need to know whether its the same in gcc. Secondly, can > anyone point me towards, or give me some help on compiling libraries for the > Net Yaroze. I read in one of the NY manuals that I should use ar.exe, but I > do not know what parameters to send to it. > > Thanks > Rikki Hi, Yes, you create yaroze libraries from standard c files containing your library functions, below is an example of how to create one. Where file.c is a library source file. Firstly create an object file from the source file, gcc -c file.c which creates the file file.o Next convert file.o into a library, ar -r libtest.a file.o creates the library libtest.a As far as I know all library names must start with lib. Next create a header file for the library, containing any function prototypes and defines that are required, then place the library and header where they can be found during compilation. In a yaroze project, #include the library header file in one of your source files, and on the gcc command line for the project add the -l option, followed by the library name, excluding the lib part. Eg. where libtest.a is the library to be included in compilation, the gcc command line would look a little like- gcc -o main main.c -ltest That's a very quick example, but at least somewhere to start at, if you have any problems just ask. Pete.