delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/04/14/17:31:35

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Trace-PostClient-IP: 68.147.131.211
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT Invalid>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Strange error message
Organization: Systematic Software
Message-ID: <fn9r70le8rmg064akh5qmr259l9rvlfn1i@4ax.com>
References: <84e4e2a9 DOT 0404140726 DOT 77691a0d AT posting DOT google DOT com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Lines: 52
Date: Wed, 14 Apr 2004 21:26:17 GMT
NNTP-Posting-Host: 24.71.223.147
X-Complaints-To: abuse AT shaw DOT ca
X-Trace: pd7tw2no 1081977977 24.71.223.147 (Wed, 14 Apr 2004 15:26:17 MDT)
NNTP-Posting-Date: Wed, 14 Apr 2004 15:26:17 MDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On 14 Apr 2004 08:26:29 -0700 in comp.os.msdos.djgpp, jbs30000 AT aol DOT com
(Joel) wrote:

>I'm trying to test an idea I have about writing an interrupt handler,
>but when I compiled the program as I was going along (to catch errors
>early) I got a strange error a couple of times.  So I saw a demo
>program in one of the help files, so I copied and pasted it, just
>making a couple of changes like adding void to the function and
>commenting out do_stuff() since it's not a function, and adding
>#include <dpmi.h> and #include <go32.h>, tried compiling the test
>program, and go the same error.  I wondered if my copy of djgpp was
>damaged, so I tried it on another copy I have on another drive, and
>still, same error.  So it's my code that's the problem, since the
>sample code given gives the same error, and it's not a damaged copy of
>djgpp.  So, I'll show the sample code, and the error, and hope that
>someone can tell me what's causing it.  Thanks.

>#include<go32.h>
>#include<dpmi.h>

>     void my_handler(_go32_dpmi_registers *r)
>     {
>       r->d.eax = 4;
>     }
>     
>     void setup()
>     {
>       _go32_dpmi_seginfo info;

>       info.pm_offset = my_handler;

>The error refersed to the info.pm_offset = my_handler
> Error: error: invalid conversion from `void (*)(__dpmi_regs*)' to
>`long
> unsigned int'

The example in libc.info node
_go32_dpmi_allocate_real_mode_callback_iret is incorrect, as you need
to cast your function pointer to the unsigned long pm_offset:

	info.pm_offset = (unsigned long)my_handler;

and the -ansi compiler option is out!  

>Also, in my program (not listed) I get the same error when I try to
>_go32_dpmi_lock_code a function of mine.

-- 
Thanks. Take care, Brian Inglis 	Calgary, Alberta, Canada

Brian DOT Inglis AT CSi DOT com 	(Brian dot Inglis at SystematicSw dot ab dot ca)
    fake address		use address above to reply

- Raw text -


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