Message-Id: <200001010422.WAA03622@lakdiva.slt.lk> From: "Kalum Somaratna aka Grendel" To: djgpp AT delorie DOT com Date: Fri, 31 Dec 1999 22:23:18 +0600 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: inline functions -- unknown references In-reply-to: X-mailer: Pegasus Mail for Win32 (v3.12) Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 31 Dec 99, at 0:03, sl wrote: > On Fri, 31 Dec 1999 03:11:20 GMT, Damian Yerrick wrote: > > >I don't know that much about inlining, but try dropping all your > >inline functions into a header file and #includeing it from your > >source files. > > I tried simply adding #include "name.cc" in the top of the header > file for the "offending code" .. but it did not help. > > Gili > > Greetings Gili, I think what you should do is that you should move your say plotpixel and other inlined fuctions to header files. The following should be in you Header file which you include. I'm using graphics.h for an example. //file graphics.h inline void put_pixel(int x,int y) { // your drawing code goes here } The above code will be in your graphics.h file. And if i have a file called game.cc which needs to use the put_pixel routine i will include the header which contains the inlined put_pixel function (graphics.h in this example) like below. //file game.cc #include "graphics.h" void main() { put_pixel(0,0) } So when the compiler sees the call to the put_pixel function it will replace it with the code in the header file without the overhead of a function call. I hope this helps and is clear. Please donot include the source as #include name.cc instead copy the inline fuctions to a header file and include it. If this is not clear please tell me (I'm writing this 1 1/2 hours before the new milennium!). Best Wishes to everyone for the new milennium. Kalum