www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/20/10:31:39

From: Charles Terry <cterry AT plinet DOT com>
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> <Eq1HwG DOT 1o AT world DOT std DOT com>
NNTP-Posting-Host: 1678 AT 207 DOT 174 DOT 3 DOT 235
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

tob AT world DOT std DOT com wrote:
> 
> Lee <jag*NOSPAM*@pangea.ca> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019