Mail Archives: djgpp/2004/04/14/17:31:35
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 -