www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/22/14:39:02

Date: Sat, 22 Feb 1997 12:31:22 -0700 (MST)
From: David May <dmay AT tvi DOT cc DOT nm DOT us>
To: Paul Hooper <unitech AT execpc DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: fmalloc HELP need. How define?
In-Reply-To: <01bc2075$7727f0e0$b429cfa9@p590>
Message-ID: <Pine.SOL.3.95.970222122520.4661D-100000@curie.tvi.cc.nm.us>
MIME-Version: 1.0

On 22 Feb 1997, Paul Hooper wrote:

> Hello:
> 
> 	I am converting some code over from another platform, and there is a call
> to _fmalloc.  In the DJGPP include, there is only a definition for malloc. 
> What should I do to reslove this undefined link?
> Advice would be greatly appreciated.  I have been using the MASM 6.11 (as
> suggested in the FAQ) by the way to do part of this project using their
> COFF option, and my experience so far has been positive.  
> 
> Thanks
> 
> Paul Hooper
> unitech AT execpc DOT com
> 

_fmalloc is a function that allows you to use far pointers under DOS
compilers like Turbo/Borland C or MS C.  DJGPP runs in a 32-bit protected
mode environment, which as far as your programs are concerned means that
you needn't concern yourself (for the most part) with far pointers.  So,
to port your code, you will want to have something like the following in
one of the header files that is included by all the C files:

#ifdef  __DJGPP__
#define far
#define near
#define huge
#define _fmalloc(size) malloc(size)
#define _fcalloc(size) calloc(size)
/* redefine any other far versions of these functions. */
#endif

It is probably a good idea to leave the _f... calls in your code.  The
original author probably put them in so your program could run under a
small or medium model and still use far pointers.

Hope this helps.

David May
ID Card Adminstrator
Albuquerque TVI


- Raw text -


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