From: "Cyberdivad" Newsgroups: comp.os.msdos.djgpp Subject: Re: make a faster blit (allegro) Date: Tue, 7 Mar 2000 19:29:35 -0000 Organization: Wanadoo, l'internet avec France Telecom Lines: 70 Message-ID: <8a3i0c$sdn$1@wanadoo.fr> References: <200003050219 DOT HAA01019 AT midpec DOT com> <8a0tfo$aaf$1 AT wanadoo DOT fr> <8a12o7$j2r$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> NNTP-Posting-Host: integ-quimper-1-2-148.abo.wanadoo.fr X-Trace: wanadoo.fr 952453964 29111 193.250.148.148 (7 Mar 2000 18:32:44 GMT) X-Complaints-To: abuse AT wanadoo DOT fr NNTP-Posting-Date: 7 Mar 2000 18:32:44 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Thanks for your answer. I'm going to test it right now, and my 60Ko source file will become more readable !! Hans-Bernhard Broeker a écrit dans le message : 8a12o7$j2r$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE... > Cyberdivad wrote: > > Here is an example of source with the project file for rhide. This example > > work only if you don't setup variables with values (like a=2;). > > In this example, this is not really a problem, but my program needs to > > assign values to var in header files. > > Then your idea of how C programming works must be wrong. What makes > you think it makes a difference for *you* (or your program), where > that initialization is? In other words, why would your program 'need' > that? It sure does make a difference to the C compiler and linker, as > defined by the programming language inventors, so you'll have to > follow their rules, rather than your personal preferences. > > I'll show you how to modify it to get a working C program. > > > source of header f.h : > > #include > > #include > > #include "allegro.h" > > > #ifndef FONC_H > > #define FONC_H > > > // here > > Change these two: > > > int d_a=10; > > int d_b=11; > > into: > > extern int d_a; > extern int d_b; > > > extern int calcab(int a, int b); > > > #endif > > ---------------- > > > source of f.c : > > #include "fonc.h" > > Add two lines, here: > > int d_a=10; > int d_b=11; > > > int calcab(int a, int b) > > { > > return a*b+d_a; > > } > > -------------- > [...] > > > Once you've checked that it works, now, go back to your C textbook and > read up on how to organize a program into multiple source files. > > -- > Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) > Even if all the snow were burnt, ashes would remain.