• C


my borland 5.03 will not complile a source containing
MK_FP, eventhough I have included dos.h.
claiming that it is an undefined function.
has anybody encountered a simular problem.

By the way does anyone know any good, graphics and
game programining for c, sites.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

k061198Author Commented:
its borland c++ 5.02 not 5.03
I do not know what MK_FP is, but maybe your source was meant for another specific compiler?? (this is very common)
 MK_FP might be the macro to make a FAR POINTER, which is specified to 16 bits programming (DOS). *If* Borland C++ 5.x could only compile 32 bits program, it won't recognize this macro.
  I am not very sure about this (since dos programming is so far away :-) . You should check this in your BC 5 compiler manual.
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Segment / Offset stuff has become meaningless in Win32, where all addresses are near. You should take a look at the code that uses that stuff, particularly how you make these segment and offset pointers. If you consistently use the library function (below) you could add new definitions for them (using segment only or intance).


#include <dos.h>
void far * MK_FP(unsigned seg, unsigned ofs);


Makes a far pointer.
MK_FP is a macro that makes a far pointer from its component segment (seg) and offset (ofs) parts.

Return Value

MK_FP returns a far pointer.


#include <dos.h>
unsigned FP_OFF(void far *p);
unsigned FP_SEG(void far *p);


Gets a far address offset or segment.
FP_OFF is a macro that gets or sets the offset of the far pointer p.
FP_SEG is a macro that gets or sets the segment value of the far pointer p.

Return Value

FP_OFF returns an unsigned integer value representing an offset value.
FP_SEG returns an unsigned integer representing a segment value.

Alternatively you could target the project for 16 bit Dos
In my Borland C++ compiler, the macro is in dos.h, however, you can merely include the macro in your own code:

#define MK_FP(seg,ofs)      ((void far *) \
                     (((unsigned long)(seg) << 16) | (unsigned)(ofs)))

Or you can construct a long pointer in a different manner such as:

char far * ptr = 0x04030040L; // Example

Hope this helps.  Kyle.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
That's an option...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.