setvect and getvect in dos.h

N

nagehan

hi all,
I try to write setvect and getvect functions of dos.h, but I don't
know how can I return a far pointer to a function?
if anybody know it, or where I can find this information, please send
e-mail to group or "(e-mail address removed)"

thanks..
nagehan
 
R

Richard Heathfield

nagehan said:
hi all,
I try to write setvect and getvect functions of dos.h, but I don't
know how can I return a far pointer to a function?

Try comp.os.ms-dos.programmer
 
M

Malcolm

nagehan said:
I try to write setvect and getvect functions of dos.h, but I don't
know how can I return a far pointer to a function?
if anybody know it, or where I can find this information, please send
e-mail to group or "(e-mail address removed)"
"far" is a DOS patch on C, and isn't ANSI. The ANSI way to do what you are
trying to achieve is to compile your program with the "large" or "huge"
models and do away with "far" altogether. Unfortunately this will have a
performance impact on your code, ranging from serious to not mattering at
all depending on the application, which is why these compilers include the
use of "far".
Probably the syntax for returning a far pointer from a function will be
someting like

char far *foo(void)
{
char far *answer;
...
return answer;
}

There won't be such a thing as a far pointer to a function (ie a far
function pointer). These will just be regualar ANSI C function pointers.
 
M

Mark McIntyre

On 12 Dec 2003 11:01:52 -0800, in comp.lang.c ,
hi all,
I try to write setvect and getvect functions of dos.h,

you mean you're trying to emulate them on some other platform than
DOS? You should ask in a group specialising in that platform.
but I don't
know how can I return a far pointer to a function?

There's no such thing as a "far pointer" in C. this is a dos-ism and
you'd need to ask in a DOS group
 
A

August Derleth

"far" is a DOS patch on C, and isn't ANSI. The ANSI way to do what you
are trying to achieve is to compile your program with the "large" or
"huge" models and do away with "far" altogether.

Well, maybe on some compilers that would allow ANSI compliant code to
compile correctly. But it isn't an ANSI solution at all, in and of itself.

In Standard C, a pointer is a pointer (assuming they're both pointers to
the same type), and there is no notion of near, far, or memory models. As
far as the Standard is concerned, the compiler is supposed to figure all
of that out without help from you.
 
M

Mark F. Haigh

August said:
news:[email protected] on Fri 12 Dec 2003 01:47:38p:

In Standard C, a pointer is a pointer (assuming they're both pointers to
the same type), and there is no notion of near, far, or memory models. As
far as the Standard is concerned, the compiler is supposed to figure all
of that out without help from you.

First sentence is right, second is wrong. The Standard does not specify
how compilers treat source files in non-conforming modes of operation.
Invoking the compiler properly is up to you, and there's no implicit
guarantee that any compiler is going to figure much of anything out
unless you invoke it with the proper options, presumably listed
somewhere in the compiler documentation.



Mark F. Haigh
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top