delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/25/12:11:18

Mime-Version: 1.0
To: "Chris Bailey" <chris DOT bailey AT softhome DOT net>, djgpp AT delorie DOT com
From: Nate Eldredge <nate AT cartsys DOT com>
Subject: Re: What is wrong with this code?
Date: Mon, 25 May 1998 09:04:34 -0700
Message-ID: <19980525160426.AAC5973@ppp101.cartsys.com>

At 01:10  5/25/1998 +0100, Chris Bailey wrote:
>I am using Allegro 3.0 and just started experimenting with datafiles that
>you can create with the grabber tool. I have used what looks like exactly
>the same syntax as the example programs but it won't work.
>
>#include <allegro.h>
>#include "test.h"        // Created by Grabber, defines TITLE_FONT to be 0
>
>int main()
>{
>DATAFILE* data;
>data = load_datafile("D:\\DJGPP\\PROGRAMS\\TEST.DAT");
>if (initialiseGraphics())
>{
>  exit(1);
>}
>clear(screen);
>textout(screen,data[TITLE_FONT].dat,"This is a test",0,0,15);
>return 0;
>}
>
>I get this error:
>
>bad argument 2 for function `void textout(struct BITMAP *, struct FONT *,
>unsigned char *, int, int, int)' (type was void *)

Are you using C++? Its strong type-checking chokes on passing a generic
`void *' (the type of data[XXX].dat) in place of some other kind of pointer.
You'll have to cast it.

textout(screen, (FONT *)data[TITLE_FONT].dat, "This is a test", 0, 0, 15);

Nate Eldredge
nate AT cartsys DOT com



g point overflow,
>+FPU on underflow, and so on.
>The linker has to generate the appropriate startup code then.

I don't think there's any good way to do that with GNU ld. Either it would
require many different pieces of startup code, with the user having to pick
between them with something arcane like `-u ___want_exception_on_overflow',
or they'd have to know the mask they wanted and say something like `--defsym
__fpu_exceptions=0x4a6'. Adding a call to `_control87' seems easier.

Nate Eldredge
nate AT cartsys DOT com



- Raw text -


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