From: Charles Terry Newsgroups: comp.os.msdos.djgpp Subject: Re: need help with d_bitmap_proc (Allegro) Date: Fri, 20 Mar 1998 08:07:02 -0800 Organization: All USENET -- http://www.Supernews.com Lines: 43 Message-ID: <351293AD.2CC3@plinet.com> References: <350F532D DOT C6DBA305 AT pangea DOT ca> NNTP-Posting-Host: 1678 AT 207 DOT 174 DOT 3 DOT 235 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk tob AT world DOT std DOT com wrote: > > Lee writes: > > However, the following code produces the error: > > initializer element for `main_dialog[5].dp' is not constant > > > > *code* > > DIALOG main_dialog[] = > > { > > /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) > > (flags) (d1) (d2) (dp) */ > > ...some stuff.... > > { d_bitmap_proc, 0, 0, 0, 0, 0, 0, 0, > > 0, 0, 0, mydat[LOGO].dat}, > > ...some other stuff > > }; > > *end code* > > It means what it says, the initializer for `main_dialog[5].dp'... > > > { d_bitmap_proc, 0, 0, 0, 0, 0, 0, 0, > > 0, 0, 0, mydat[LOGO].dat}, > ^^^^^^^^^^^^^^^ main_dialog[5].dp > > ...is not constant. And it isn't. The compiler can't reduce > mydat[LOGO].dat to a constant pointer at compile time. You have to > initialize that element by hand. > > Tom I think that the original code will work if it is within a function body ( I assume it is a static variable as written). If you need a static global create the dialog with all elements except .proc to null then in main() use main_dialog.dp=mydat[LOGO].dat. An aside- Ive been working with allegro dialogs and found it very useful to convert the code to C++ so the dialog functions such as do_dialog use a DIALOG ** so the paticular dialogs can be created by new() and Initializes by a constuctor. Charles Terry