Path: chuka.playstation.co.uk!news From: James Russell Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: urgent help required Date: Wed, 31 Mar 1999 10:09:20 +0100 Organization: Sony Computer Entertainment Europe Lines: 49 Message-ID: <3701E640.CBC21474@scee.sony.co.uk> References: <3702c554.12329198@news.playstation.co.uk> <3700A393.CDC973F6@scee.sony.co.uk> <37042895.8289675@news.playstation.co.uk> NNTP-Posting-Host: mailgate.scee.sony.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.51 [en] (Win95; I) X-Accept-Language: en Righto: Say you've got the binary file "Bananas.tmd". You want to reference this in your program as "fruit_TMD". Then run "raw2src bananas.tmd bananas.c fruit_TMD". This converts it to a C file with a big char array containing all the bytes of the file. Now the important phrase here is 'char array'. The array is defined as: char fruit_TMD[] = { 0x12, 0x34, ... }; This means fruit_TMD is actually a of type (char*). If you're using it in functions which want the address of fruit_TMD, then they usually require it as a unsigned long* (u_long *). So you have to cast it first. EG: void MyInitTMDs() { u_long *fruit = (u_long *)fruit_TMD; ... GS_LinkObject4(fruit + 1, objectbase, somethingelse); ... } That'll get rid of the "incompatible pointer type" errors. Secondly, unless you "#include" the bananas.c file (bad idea), the above function isn't going to know that fruit_TMD is a char* at all. So you have to tell it explicitly that there is an external object file containing a reference called fruit_TMD, and that fruit_TMD is a char*. So somewhere before the function defined above, you'd put the line: extern char fruit_TMD[]; You should be running: gcc -c bananas.c -o bananas.o and NOT #includ'ing the bananas.c in multiple C files. If you were, that would explain the multiple references thing, because you'd be defining the array in many different object files. Cheers, James -- == James_Russell@scee.sony.co.uk ph: +44 (171) 447-1626 - fax: 390 4324 == Tools and Middleware Licensing Manager - Sony Computer Entertainment Europe COBOL programmers understand why women hate periods.